-
Notifications
You must be signed in to change notification settings - Fork 27
/
webpack.config.js
73 lines (69 loc) · 1.82 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
61
62
63
64
65
66
67
68
69
70
71
72
73
var path = require('path');
var webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const extractSass = new ExtractTextPlugin({
filename: "css/[name].css",
disable: process.env.NODE_ENV === "development"
});
var HtmlWebpackPlugin = require('html-webpack-plugin');
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
entry: './src/main.js',
output: {
filename: 'js/main.js',
path: path.resolve(__dirname, 'public')
},
plugins: [
new BundleAnalyzerPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
new webpack.optimize.UglifyJsPlugin({
beautify: false,
pure_getters: true,
mangle: {
screw_ie8: true,
keep_fnames: true
},
compress: {
screw_ie8: true
},
comments: false,
exclude: [/\.min\.js$/gi] // skip pre-minified libs
})
],
module: {
loaders: [
{
test: /\.scss$/,
exclude: /(node_modules|bower_components)/,
use: extractSass.extract({
use: [{
loader: "css-loader?-minimize"
}, {
loader: "sass-loader"
}]
})
},
{
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}
],
},
resolve: {
extensions: ['js'],
// fallback: [path.join(__dirname, '../node_modules')],
alias: {
'vue': 'vue/dist/vue.common.js'
}
},
plugins: [
extractSass
],
devtool: 'cheap-module-source-map'
}