-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
72 lines (70 loc) · 1.89 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
'use strict';
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
devtool: 'source-map',
entry: {
browser: [
'webpack-hot-middleware/client?reload=true',
path.join(__dirname, 'app/App.js')
],
ieCompatible: path.join(__dirname, 'app/utils/ie-compatible.js'),
mobile: [
'webpack-hot-middleware/client?reload=true',
path.join(__dirname, 'app/App-h5.js')
]
},
output: {
path: path.join(__dirname, '/dist/'),
filename: '[name].js',
publicPath: '/'
},
plugins: [
new HtmlWebpackPlugin({
template: 'app/index.html',
filename: 'index.html',
chunks: ['browser', 'ieCompatible']
}),
new HtmlWebpackPlugin({
template: 'app/index-h5.html',
inject: 'body',
filename: 'index-h5.html',
chunks: ['mobile']
}),
new ExtractTextPlugin('[name].css'),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
],
module: {
loaders: [{
test: /\.js?$/,
exclude: /node_modules/,
loader: 'babel'
},{
test: /\.js?$/,
exclude: /[node_modules|lib]/,
loader: 'eslint'
}, {
test: /\.json?$/,
loader: 'json'
}, {
test: /\.css$/,
loader: 'style!css?modules&localIdentName=[name]---[local]---[hash:base64:5]'
}, {
test: /\.less$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!less-loader')
}, {
test: /\.(woff(2)?|eot|ttf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}, {
test: /\.(png|jpg|jpeg|gif)$/,
loader: 'file-loader?name=i/[name].[ext]'
}]
}
};