-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.config.js
53 lines (51 loc) · 1.42 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
const webpack = require('webpack'),
path = require('path'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
TransferWebpackPlugin = require('transfer-webpack-plugin');
module.exports = {
entry: {
index: [
'eventsource-polyfill', //兼容ie
'webpack-hot-middleware/client?reload=true', //看上面
'./src/index.js'
]
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
publicPath: '/dist'
},
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}, {
test: /\.css$/,
loader: 'style-loader!css-loader'
}],
postLoaders: [{
test: /\.js$/,
loader: "es3ify-loader"
}]
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, 'src/index.html'),
filename: 'index.html',
inject: true
}),
new TransferWebpackPlugin([
{ from: 'services/polyfill', to: '/js' }
], path.join(__dirname, 'src')),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
resolve: {
alias: {
react: "anujs/dist/ReactIE.js",
"react-dom": "anujs/dist/ReactIE.js"
}
}
}