2018-07-30 15:48:02 +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({
|
|
|
|
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-23 20:44:54 +01:00
|
|
|
experimental: { css: true },
|
2019-05-30 03:19:32 +02:00
|
|
|
poweredByHeader: false,
|
|
|
|
cssModules: true,
|
|
|
|
serverRuntimeConfig: {
|
2019-11-11 04:24:53 +01:00
|
|
|
mySecret: 'secret',
|
2019-05-30 03:19:32 +02:00
|
|
|
},
|
|
|
|
publicRuntimeConfig: {
|
2019-11-11 04:24:53 +01:00
|
|
|
staticFolder: '/static',
|
2019-05-30 03:19:32 +02:00
|
|
|
},
|
|
|
|
env: {
|
2019-11-11 04:24:53 +01:00
|
|
|
customVar: 'hello',
|
2019-05-30 03:19:32 +02:00
|
|
|
},
|
2019-11-11 04:24:53 +01:00
|
|
|
webpack(config, { buildId, webpack }) {
|
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-07-30 15:48:02 +02:00
|
|
|
|
2019-05-30 03:19:32 +02:00
|
|
|
if (nextCssNodeModulesLocation.indexOf(nextLocation) === -1) {
|
|
|
|
config.resolveLoader.modules.push(nextCssNodeModulesLocation)
|
|
|
|
}
|
|
|
|
config.plugins.push(
|
|
|
|
new webpack.DefinePlugin({
|
2019-11-11 04:24:53 +01:00
|
|
|
'process.env.CONFIG_BUILD_ID': JSON.stringify(buildId),
|
2019-05-30 03:19:32 +02:00
|
|
|
})
|
|
|
|
)
|
2018-06-25 23:06:46 +02:00
|
|
|
|
2019-05-30 03:19:32 +02:00
|
|
|
return config
|
2019-11-11 04:24:53 +01:00
|
|
|
},
|
2019-05-30 03:19:32 +02:00
|
|
|
})
|
|
|
|
)
|