-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
60 lines (56 loc) · 1.39 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
var path = require('path');
var webpack = require('webpack');
//var OpenBrowserPlugin = require('open-browser-webpack-plugin');
// var HtmlwebpackPlugin = require('html-webpack-plugin');
module.exports = {
// entry: './src/main.js',
entry: [
'./lib/build.js' // Your appʼs entry point
],
output: {
filename: './public/js/bundle.js'
},
//target: 'node',
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel-loader',
loaders: ['react-hot', 'jsx?harmony'],
include: path.join(__dirname, 'src'),
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
]
},
plugins: [
// new webpack.DefinePlugin({
// __DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
// }),
new webpack.HotModuleReplacementPlugin(),
//提取多个入口文件的公共脚本部分
//new webpack.optimize.CommonsChunkPlugin('common.js'),
// new HtmlwebpackPlugin({
// title: 'Webpack-demos',
// filename: 'index.html'
// }),
// new OpenBrowserPlugin({
// url: 'http://localhost:8080'
// }),
//压缩代码会增加打包代码的时间
// new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: false
// }
// })
],
resolve: {
// you can now require('file') instead of require('file.coffee')
extensions: ['', '.js', '.json', '.jsx']
}
};