-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
41 lines (39 loc) · 1.22 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
const webpack = require('webpack');
var path = require('path');
var commonConfig = require('./webpack.config.common');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var extractCSS = new ExtractTextPlugin('css/style.css');
var output = {
path: path.resolve(__dirname, 'public'),
// publicPath: 'http://www.example.com/build/',
filename: 'js/bundle.js'
};
module.exports = Object.assign(commonConfig, {
output: output,
module: {
rules: commonConfig.module.rules.concat([{
test: /\.s?css$/,
use: extractCSS.extract({
fallback: "style-loader",
use: [ {
loader: "css-loader",
options: { minimize: true }
}, {
loader: 'sass-loader',
options: { minimize: true }
} ]
})
}])
},
plugins: commonConfig.plugins.concat([
new CleanWebpackPlugin('public'),
extractCSS,
new webpack.LoaderOptionsPlugin({debug: true}),
new webpack.optimize.CommonsChunkPlugin('vendor'),
// new webpack.optimize.DedupePlugin(),
new UglifyJSPlugin(),
new webpack.optimize.AggressiveMergingPlugin()
])
});