-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
46 lines (43 loc) · 1.09 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
const webpack = require('webpack')
//打开浏览器
const WebpackBrowserPlugin = require('webpack-browser-plugin');
//单独打包css
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const htmlWebpackPlugin = require('html-webpack-plugin');
const config = {
entry:'./src/index.js',
output:{
filename:'bundle[hash:8].js',
publicPath:'dist/',
path:__dirname+'/dist'
},
'devtool': "source-map",
module:{
loaders:[
{
test:/\.js/,
exclude:/node_module/,
loader:'babel-loader?presets[]=es2015&presets[]=react'
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
},
{
test:/\.less$/i,
// loader: 'style!css!less'
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
}
]
},
plugins: [
new ExtractTextPlugin("bundle[hash:8].css"),
new htmlWebpackPlugin({
template: './src/index.html',
filename: './index.html'
}),
new WebpackBrowserPlugin()
// new webpack.optimize.UglifyJsPlugin()
]
};
module.exports = config;