-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.on.js
47 lines (46 loc) · 1.3 KB
/
webpack.config.on.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
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
//项目的文件夹 可以直接用文件夹名称 默认会找index.js 也可以确定是哪个文件名字
entry: {
app: './app/index',
},
//输出的文件名 合并以后的js会命名为bundle.js
output: {
path: './dist',
filename: '[name].min.js'
},
//添加我们的插件 会自动生成一个html文件
plugins: [
new ExtractTextPlugin("styles.css"),
//这个使用uglifyJs压缩你的js代码
new webpack.optimize.UglifyJsPlugin({
// minimize: true,npm install uglify-loader --save-dev
compress: {
warnings: false
}
}),
],
module: {
loaders: [
{test: /\.css$/, loader: 'style!css'},
// {test: /\.less$/, loader: ExtractTextPlugin.extract('style-loader','css-loader','postcss-loader','less-loader')},
{test: /\.less$/, loader: 'style-loader!css-loader!postcss-loader!less-loader'},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /(node_modules|bower_components)/,
query: {
presets: ['es2015']
}
}
]
},
postcss: function() {
return [
require('autoprefixer')({
browsers: ['last 7 versions'],
})
];
}
};