mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
ba8cb31a40
Saw a reply on the original pull request that the WebSocket using a random port broke their set up so I added a `--websocket` or `-w` argument similar to the `-p` argument to allow manually setting this port also.
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
const withCSS = require('@zeit/next-css')
|
|
const withSass = require('@zeit/next-sass')
|
|
const webpack = require('webpack')
|
|
const path = require('path')
|
|
module.exports = withCSS(withSass({
|
|
onDemandEntries: {
|
|
// Make sure entries are not getting disposed.
|
|
maxInactiveAge: 1000 * 60 * 60,
|
|
websocketPort: 3001
|
|
},
|
|
cssModules: true,
|
|
serverRuntimeConfig: {
|
|
mySecret: 'secret'
|
|
},
|
|
publicRuntimeConfig: {
|
|
staticFolder: '/static'
|
|
},
|
|
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)
|
|
}
|
|
config.plugins.push(
|
|
new webpack.DefinePlugin({
|
|
'process.env.CONFIG_BUILD_ID': JSON.stringify(buildId)
|
|
})
|
|
)
|
|
|
|
return config
|
|
}
|
|
}))
|