-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.plugins.js
35 lines (33 loc) · 1.05 KB
/
webpack.config.plugins.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
const cssnano = require('cssnano');
const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const paths = require('./paths');
module.exports = {
dev: [
new HtmlWebpackPlugin({
template: path.join(paths.src, 'index.html'),
}),
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin(),
new StyleLintPlugin(),
],
prod: [
new CleanWebpackPlugin(paths.dist),
new HtmlWebpackPlugin({
template: path.join(paths.src, 'index.html'),
}),
new ExtractTextPlugin('app.bundle.css'),
new UglifyJSPlugin({
sourceMap: true,
}),
new OptimizeCssAssetsPlugin({
cssProcessor: cssnano,
}),
],
};