mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
3582496913
Solves inconsistent loading issues when one bundle is loaded faster than the other Fixes zeit/next-plugins#244 Fixes #4997 Fixes #4620
24 lines
755 B
JavaScript
24 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
|
|
}
|
|
}))
|