-
Notifications
You must be signed in to change notification settings - Fork 2
/
.sweetrc.js
66 lines (64 loc) · 1.61 KB
/
.sweetrc.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const path = require('path');
const process = require('process');
const PreloadWebpackPlugin = require('preload-webpack-plugin');
const isDevelopment = process.env.NODE_ENV === 'development';
module.exports = {
frame: 'react',
dll: [
'react',
'react-dom',
'prop-types',
'react-router',
'react-router-dom',
'redux',
'react-redux',
'redux-thunk',
'redux-actions',
'immutable',
'redux-immutable',
'reselect',
'react-helmet'
],
entry: {
index: [path.join(__dirname, 'src/index.js')]
},
serverRender: true,
serverEntry: {
server: [path.join(__dirname, 'src/server.js')]
},
rules: [
{
test: /gt\.min\.js/,
use: [{
loader: 'file-loader',
options: {
name: isDevelopment ? '[name].[hash:5].[ext]' : '[hash:5].[ext]',
outputPath: 'script/'
}
}]
}
],
js: {
plugins: [['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }]],
exclude: /(dll\.js|gt\.min\.js|node_modules|utils[\\/]encryption\.js)/
},
sass: { include: /src/ },
css: {
modules: false,
modifyVars: {
// https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less
'@primary-color': '#faad14'
},
include: /node_modules[\\/]antd/
},
html: [
{ template: path.join(__dirname, 'src/index.pug') },
{ template: path.join(__dirname, 'src/modules/Login/Description/description.pug'), excludeChunks: ['index'] }
],
plugins: isDevelopment ? undefined : [
new PreloadWebpackPlugin({
rel: 'prefetch',
include: 'asyncChunks'
})
]
};