-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
58 lines (55 loc) · 1.28 KB
/
webpack.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
53
54
55
56
57
58
const webpack = require('webpack');
const path = require('path');
const PATH_SRC = path.join(__dirname, 'src');
module.exports = {
context: PATH_SRC,
entry: {
app: './index.js',
vendor: ['mobx-react', 'mobx', 'react-router-dom', 'react', 'react-dom']
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.json$/,
use: 'json-loader'
},
{
test: /\.(png|jpg|jpeg|gif)$/,
loader: 'url-loader',
options: {
limit: 8192,
name: '[name].[hash:8].[ext]'
}
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[hash:8].[ext]'
}
}
],
},
resolve: {
extensions: ['.js', '.jsx'],
modules: [
PATH_SRC,
'node_modules',
],
mainFiles: ['index', 'main'],
alias: { //指定路径的别名
Utils: path.resolve(__dirname, 'src/utils'),
Components: path.resolve(__dirname, 'src/components'),
Containers: path.resolve(__dirname, 'src/containers'),
Assets: path.resolve(__dirname, 'src/assets'),
Stores: path.resolve(__dirname, 'src/stores'),
},
},
plugins: [
]
};