-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
75 lines (72 loc) · 2.03 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
73
74
/**
* Created by tcstory on 5/11/16.
*/
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
app: './src/pages/app/app.jsx',
'react-libs': ['react', 'react-dom']
},
output: {
filename: 'js/[name].js',
chunkFilename: "js/chunk/[name].js",
path: './dist',
publicPath: '/'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.(css)$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader', {
publicPath: '../'
})
},
{
test: /\.(scss)$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader', {
publicPath: '../'
})
},
{
test: /\.(gif|png|jpg|svg)$/,
loader: 'url-loader?limit=8192&name=asset/images/[name].[ext]'
},
{
test: /\.(m4a|mp3)$/,
loader: 'file-loader?name=asset/audios/[name].[ext]'
}
],
noParse: [
'node_modules/react/dist/react.min.js',
'node_modules/react-dom/dist/react-dom.min.js'
]
},
devServer: {
historyApiFallback: true,
noInfo: true,
contentBase:'./dist/'
},
plugins: [
new HtmlWebpackPlugin({
template: './src/pages/app/app.html',
filename: 'app.html',
inject: 'body'
}),
new ExtractTextPlugin('css/[name].css'),
new webpack.optimize.CommonsChunkPlugin({
name: "react-libs",
filename: "js/react-libs.js",
minChunks: Infinity
}),
new webpack.DefinePlugin({
__DEV__: true
})
]
};