2018-07-30 13:48:02 +00:00
|
|
|
const withCSS = require('@zeit/next-css')
|
|
|
|
const withSass = require('@zeit/next-sass')
|
2018-06-25 21:06:46 +00:00
|
|
|
const webpack = require('webpack')
|
2018-07-30 13:48:02 +00:00
|
|
|
const path = require('path')
|
|
|
|
module.exports = withCSS(withSass({
|
2018-02-05 16:18:31 +00:00
|
|
|
onDemandEntries: {
|
|
|
|
// Make sure entries are not getting disposed.
|
2019-01-01 00:07:10 +00:00
|
|
|
maxInactiveAge: 1000 * 60 * 60,
|
|
|
|
websocketPort: 3001
|
2018-02-05 16:18:31 +00:00
|
|
|
},
|
2018-02-26 11:03:27 +00:00
|
|
|
cssModules: true,
|
2018-02-27 16:50:14 +00:00
|
|
|
serverRuntimeConfig: {
|
|
|
|
mySecret: 'secret'
|
|
|
|
},
|
|
|
|
publicRuntimeConfig: {
|
|
|
|
staticFolder: '/static'
|
2018-06-25 21:06:46 +00:00
|
|
|
},
|
2019-02-08 13:38:18 +00:00
|
|
|
env: {
|
|
|
|
customVar: 'hello'
|
|
|
|
},
|
2018-06-25 21:06:46 +00:00
|
|
|
webpack (config, {buildId}) {
|
2018-07-30 13:48:02 +00: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'
|
|
|
|
)
|
|
|
|
|
|
|
|
if (nextCssNodeModulesLocation.indexOf(nextLocation) === -1) {
|
|
|
|
config.resolveLoader.modules.push(nextCssNodeModulesLocation)
|
|
|
|
}
|
2018-06-25 21:06:46 +00:00
|
|
|
config.plugins.push(
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env.CONFIG_BUILD_ID': JSON.stringify(buildId)
|
|
|
|
})
|
|
|
|
)
|
|
|
|
|
|
|
|
return config
|
2018-02-26 11:03:27 +00:00
|
|
|
}
|
2018-07-30 13:48:02 +00:00
|
|
|
}))
|