-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
33 lines (32 loc) · 960 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
// webpack.config.js
var path = require("path");
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
bundle:['./src/index.js'],
},
output: {
path: path.join(__dirname, 'build'),
publicPath: "/build/",
filename: '[name].js'
},
// 新添加的module属性
module: {
loaders: [
{ test: /\.jsx$/, exclude: /node_modules/, loader: 'jsx-loader!babel-loader' },
{ test: /\.js$/, exclude:/node_modules/, loader: 'babel-loader'},
{test: /\.(jpg|png)$/, loader: "url?limit=8192"},
{test: /\.css$/, loader: "style-loader!css-loader"}, // 把多个css压缩到一个css中。
]
},
babel: {
presets: ["es2015", "react", "stage-2"]
},
devServer: { inline: true },
plugins: [
new webpack.optimize.CommonsChunkPlugin('common.js'),
new ExtractTextPlugin("[name].css"),
new webpack.HotModuleReplacementPlugin()
]
};