-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnext.config.js
37 lines (34 loc) · 918 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
const withPlugins = require('next-compose-plugins');
const images = require('next-images');
const sass = require('@zeit/next-sass');
const webpack = require('webpack');
require('dotenv').config({
path: process.env.NODE_ENV === 'production' ? '.env.production' : '.env',
});
const nextConfig = {
distDir: 'build',
webpack: (config) => {
const newConfig = config;
newConfig.node = {
fs: 'empty',
net: 'empty',
tls: 'empty',
};
const env = Object.keys(process.env).reduce((acc, curr) => {
acc[`process.env.${curr}`] = JSON.stringify(process.env[curr]);
return acc;
}, {});
newConfig.plugins.push(new webpack.DefinePlugin(env));
return newConfig;
},
};
module.exports = withPlugins([
[sass, {
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: '[local]_[hash:base64:3]',
},
}],
images,
], nextConfig);