forked from keenethics/keenethics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
50 lines (42 loc) · 1.32 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
/* eslint no-param-reassign: ["error", { "props": false }] */
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { ANALYZE } = process.env;
module.exports = {
webpack: (config) => {
if (ANALYZE) {
config.plugins.push(new BundleAnalyzerPlugin({
analyzerMode: 'server',
analyzerPort: 8888,
openAnalyzer: true,
}));
}
const entry = config.entry();
return entry.then((value) => {
value[path.resolve(__dirname, 'static/main.css')] = path.resolve(__dirname, 'styles/main.scss');
config.entry = value;
config.module.rules.push({
test: /\.css$/,
loader: 'emit-file-loader',
options: {
name: '[path][name].[ext]',
},
});
config.module.rules.push({
test: /\.scss$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader', 'sass-loader'],
}),
include: [
path.resolve(__dirname, 'styles'),
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'static'),
],
});
config.plugins.push(new ExtractTextPlugin('[name]'));
return config;
});
},
};