-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
52 lines (48 loc) · 1.7 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
51
52
const withTypescript = require('@zeit/next-typescript');
const withCSS = require('@zeit/next-css');
const withSass = require('@zeit/next-sass');
const path = require('path');
const webpack = require('webpack');
module.exports = withCSS(withSass(withTypescript({
webpack: (config, { dev }) => {
config.node = {
fs: 'empty',
};
config.resolve = {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
alias: {
'@common': path.resolve(__dirname, 'src/common'),
'@components': path.resolve(__dirname, 'src/components'),
'@redux': path.resolve(__dirname, 'src/redux'),
'@routes': path.resolve(__dirname, 'src/routes'),
'@shared': path.resolve(__dirname, 'src/shared'),
'@static': path.resolve(__dirname, 'src/static'),
'@layouts': path.resolve(__dirname, 'src/layouts'),
'@util': path.resolve(__dirname, 'src/util'),
}
};
config.module.rules.push({
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
use: {
loader: 'url-loader',
options: {
limit: 100000
}
}
});
if (dev) {
config.devtool = 'cheap-module-source-map';
config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: 'tslint-loader'
});
}
config.plugins.push(
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(dev ? 'development' : 'production'),
})
);
return config;
},
distDir: '../.next'
})));