Updated next config to not need node-sass in production
This commit is contained in:
@@ -1,22 +1,26 @@
|
||||
const withSass = require('@zeit/next-sass')
|
||||
const { ANALYZE } = process.env
|
||||
let AnalyzerPlugin
|
||||
const { ANALYZE, BUILD, NODE_ENV } = process.env
|
||||
let conf = {
|
||||
poweredByHeader: false,
|
||||
}
|
||||
|
||||
if (ANALYZE) {
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
||||
AnalyzerPlugin = BundleAnalyzerPlugin
|
||||
}
|
||||
module.exports = withSass({
|
||||
poweredByHeader: false,
|
||||
webpack: function(config, { isServer }) {
|
||||
if (ANALYZE) {
|
||||
config.plugins.push(
|
||||
new AnalyzerPlugin({
|
||||
analyzerMode: 'server',
|
||||
analyzerPort: isServer ? 8888 : 8889,
|
||||
openAnalyzer: true,
|
||||
})
|
||||
)
|
||||
}
|
||||
conf.webpack = function(config, { isServer }) {
|
||||
config.plugins.push(
|
||||
new BundleAnalyzerPlugin({
|
||||
analyzerMode: 'server',
|
||||
analyzerPort: isServer ? 8888 : 8889,
|
||||
openAnalyzer: true,
|
||||
})
|
||||
)
|
||||
return config
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Only add sass module when building or during dev
|
||||
if (BUILD || NODE_ENV !== 'production') {
|
||||
const withSass = require('@zeit/next-sass')
|
||||
conf = withSass(conf)
|
||||
}
|
||||
|
||||
module.exports = conf
|
||||
|
||||
Reference in New Issue
Block a user