-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
45 lines (42 loc) · 981 Bytes
/
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
const path = require('path');
module.exports = {
/*入口*/
entry: [
'react-hot-loader/patch',
path.join(__dirname, 'src/index.js')
],
/*输出到dist文件夹,输出文件名字为bundle.js*/
output: {
path: path.join(__dirname, './dist'),
filename: 'bundle.js'
},
resolve: {
extensions: ['.js', '.jsx'],
alias: {
pages: path.join(__dirname, 'src/pages'),
component: path.join(__dirname, 'src/component'),
router: path.join(__dirname, 'src/router')
}
},
module: {
rules: [
{
"exclude": "/node_modules/",
// "include": "./src/",
"loader": "babel-loader",
"options": {
"presets": ["es2015", "react"],
"plugins": [
"react-hot-loader/babel"
]
},
"test": /\.jsx?$/
}
]
},
devServer: {
contentBase: path.join(__dirname, './dist'),
historyApiFallback: true
},
devtool: 'inline-source-map'
};