-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathwebpack.config.js
55 lines (53 loc) · 1.77 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
var webpack = require('webpack');
var path = require('path');
var autoprefixer = require('autoprefixer');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var OpenBrowserPlugin = require('open-browser-webpack-plugin');
module.exports = {
context: path.join(__dirname, 'example'),
entry: {
js: './app.js',
vendor: ['react', 'classnames', 'react-router', 'react-dom', 'react-addons-css-transition-group']
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: './bundle.js'
},
module: {
loaders:[
{
test: /\.js[x]?$/,
exclude: /node_modules/,
loader: 'babel'
}, {
test: /\.less$/,
loader: ExtractTextPlugin.extract('style-loader', 'css!postcss!less')
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css', 'postcss')
}, {
test: /\.(png|jpg)$/,
loader: 'url?limit=25000'
}
]
},
postcss: [autoprefixer],
plugins: [
new webpack.DefinePlugin({
DEBUG: process.env.NODE_ENV !== 'production'
}),
new ExtractTextPlugin('f-ui.css',{allChunks: true}),
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),
new webpack.optimize.UglifyJsPlugin({
// extractCSS : true,
sourceMap: false,
mangle: false,
// minimize:true
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'example/index.html')
})
// new OpenBrowserPlugin({ url: 'http://localhost:8080' })
]
};