rsnext/test/integration/production-config/next.config.js
Tim Neutkens e1502bc9a5
Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps

Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.

* Update tests

* Update test to run on webpack 4 instead of webpack 5

* disable webpack5 for legacy tests

* Fix stats-config for webpack4

* update tests

* update size for webpack4 test

* move basic suite first

* update basic test

* Add logs

* remove outdated testFutureDependencies job

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-06-07 15:48:29 -05:00

50 lines
1.3 KiB
JavaScript

const withCSS = require('@zeit/next-css')
const withSass = require('@zeit/next-sass')
const path = require('path')
module.exports = withCSS(
withSass({
// @zeit/next-sass is not supported with webpack 5
webpack5: false,
env: {
...(process.env.ENABLE_ENV_FAIL_UNDERSCORE
? {
__NEXT_MY_VAR: 'test',
}
: {}),
...(process.env.ENABLE_ENV_FAIL_NODE
? {
NODE_ENV: 'abc',
}
: {}),
...(process.env.ENABLE_ENV_WITH_UNDERSCORES
? {
SOME__ENV__VAR: '123',
}
: {}),
},
onDemandEntries: {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60,
},
webpack(config) {
// 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'
)
if (nextCssNodeModulesLocation.indexOf(nextLocation) === -1) {
config.resolveLoader.modules.push(nextCssNodeModulesLocation)
}
return config
},
async generateBuildId() {
return 'custom-buildid'
},
})
)