-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
39 lines (34 loc) · 921 Bytes
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { ANALYZE, ASSET_HOST } = process.env
// for those who using CDN
const assetPrefix = ASSET_HOST || ''
const withCSS = require('@zeit/next-css')
module.exports = withCSS({
assetPrefix,
cssModules: true,
webpack: (config, { dev }) => {
config.output.publicPath = `${assetPrefix}${config.output.publicPath}`
if (ANALYZE) {
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
config.plugins.push(new BundleAnalyzerPlugin({
analyzerMode: 'server',
analyzerPort: 8888,
openAnalyzer: true
}))
}
config.module.rules.push({
test: /\.scss/,
use: [{
loader: 'emit-file-loader',
options: {
name: 'dist/[path][name].[ext]'
}
},
'babel-loader',
'styled-jsx-css-loader', {
loader: 'sass-loader',
options: { sourceMap: dev }
}]
})
return config
}
})