rsnext/test/integration/production-config/next.config.js
Tim Neutkens 3582496913
Trigger page register when module is executed (#5115)
Solves inconsistent loading issues when one bundle is loaded faster than the other

Fixes zeit/next-plugins#244
Fixes #4997
Fixes #4620
2018-09-11 20:03:20 +02:00

23 lines
755 B
JavaScript

const withCSS = require('@zeit/next-css')
const withSass = require('@zeit/next-sass')
const path = require('path')
module.exports = withCSS(withSass({
onDemandEntries: {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60
},
webpack (config, {buildId}) {
// 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
}
}))