-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
45 lines (37 loc) · 1.07 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
require('dotenv').config();
// eslint-disable-line
const webpack = require('webpack');
const StyleLintPlugin = require('stylelint-webpack-plugin');
// const FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin');
const withCSS = require('@zeit/next-css');
module.exports = withCSS({
webpack: (config, { dev }) => {
const customConfig = {
...config,
};
customConfig.plugins = config.plugins.filter(
(plugin) => plugin.constructor.name !== 'UglifyJsPlugin',
);
// Environment variables
customConfig.plugins.push(new webpack.EnvironmentPlugin(process.env));
if (dev) {
config.plugins.push(
new StyleLintPlugin({
configFile: './.stylelintrc.js',
files: ['**/*.css'],
emitErrors: false,
}),
);
// FIXME: Getting hot-reloader errors if Flow catches something
// Commented for now
// config.plugins.push(new FlowBabelWebpackPlugin());
// customConfig.module.rules.push({
// enforce: 'pre',
// test: /\.js$/,
// exclude: /node_modules/,
// loader: 'eslint-loader',
// });
}
return customConfig;
},
});