forked from TaoriYu/nextjs_app_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
31 lines (27 loc) · 856 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
const withTypescript = require('./utils/build/withTypescript');
const withCSS = require('@zeit/next-css');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const getConfig = require('./config/compileConfig');
const customs = () => ({
webpack: (config, options) => {
// Fixes npm packages that depend on `fs` module
config.node = {
fs: 'empty',
path: 'empty'
};
if (options.isServer) config.plugins.push(new ForkTsCheckerWebpackPlugin());
config.plugins.push(new (require('webpack').DefinePlugin)({
'process.env.SERVER': options.isServer,
}));
return config
},
...getConfig(),
});
module.exports = withTypescript(withCSS({
cssModules: 'global',
cssLoaderOptions: {
importLoaders: 1,
localIdentName: "[name]_[local]__[hash:base64:5]",
},
...customs(),
}));