2018-09-11 20:03:20 +02:00
|
|
|
const withCSS = require('@zeit/next-css')
|
|
|
|
const withSass = require('@zeit/next-sass')
|
|
|
|
const path = require('path')
|
2019-05-30 03:19:32 +02:00
|
|
|
module.exports = withCSS(
|
|
|
|
withSass({
|
|
|
|
env: {
|
|
|
|
...(process.env.ENABLE_ENV_FAIL_UNDERSCORE
|
|
|
|
? {
|
2019-11-11 04:24:53 +01:00
|
|
|
__NEXT_MY_VAR: 'test',
|
|
|
|
}
|
2019-05-30 03:19:32 +02:00
|
|
|
: {}),
|
|
|
|
...(process.env.ENABLE_ENV_FAIL_NODE
|
|
|
|
? {
|
2019-11-11 04:24:53 +01:00
|
|
|
NODE_ENV: 'abc',
|
|
|
|
}
|
2019-07-29 09:17:10 +02:00
|
|
|
: {}),
|
|
|
|
...(process.env.ENABLE_ENV_WITH_UNDERSCORES
|
|
|
|
? {
|
2019-11-11 04:24:53 +01:00
|
|
|
SOME__ENV__VAR: '123',
|
|
|
|
}
|
|
|
|
: {}),
|
2019-05-30 03:19:32 +02:00
|
|
|
},
|
|
|
|
onDemandEntries: {
|
|
|
|
// Make sure entries are not getting disposed.
|
2019-11-11 04:24:53 +01:00
|
|
|
maxInactiveAge: 1000 * 60 * 60,
|
2019-05-30 03:19:32 +02:00
|
|
|
},
|
2019-12-13 21:23:28 +01:00
|
|
|
experimental: { css: true },
|
2019-11-11 04:24:53 +01:00
|
|
|
webpack(config) {
|
2019-05-30 03:19:32 +02:00
|
|
|
// When next-css is `npm link`ed we have to solve loaders from the project root
|
|
|
|
const nextLocation = path.join(
|
|
|
|
require.resolve('next/package.json'),
|
|
|
|
'../'
|
|
|
|
)
|
|
|
|
const nextCssNodeModulesLocation = path.join(
|
|
|
|
require.resolve('@zeit/next-css'),
|
|
|
|
'../../../node_modules'
|
|
|
|
)
|
2018-09-11 20:03:20 +02:00
|
|
|
|
2019-05-30 03:19:32 +02:00
|
|
|
if (nextCssNodeModulesLocation.indexOf(nextLocation) === -1) {
|
|
|
|
config.resolveLoader.modules.push(nextCssNodeModulesLocation)
|
|
|
|
}
|
2018-09-11 20:03:20 +02:00
|
|
|
|
2019-05-30 03:19:32 +02:00
|
|
|
return config
|
|
|
|
},
|
2019-11-11 04:24:53 +01:00
|
|
|
async generateBuildId() {
|
2019-05-30 03:19:32 +02:00
|
|
|
return 'custom-buildid'
|
2019-11-11 04:24:53 +01:00
|
|
|
},
|
2019-05-30 03:19:32 +02:00
|
|
|
})
|
|
|
|
)
|