-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.config.js
49 lines (42 loc) · 1.27 KB
/
webpack.dev.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
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var CopyWebpackPlugin = require('copy-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin')
// var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
var config = require('./webpack.base.config');
var plugins = [
////js压缩
// new webpack.optimize.UglifyJsPlugin({
// sourceMap: true,
// compress: {
// warnings: false
// },
// }),
// //css压缩
// new webpack.LoaderOptionsPlugin({
// minimize: true,
// })
//css压缩
// new OptimizeCssAssetsPlugin({
// assetNameRegExp: /\.css$/g,
// cssProcessor: require('cssnano'),
// cssProcessorOptions: { discardComments: {removeAll: true } },
// canPrint: true
// }),
new HtmlWebpackPlugin({
template: './app/index.html',
server: 'http://localhost:7777/dist/',
debug: true,
excludeChunks: ['js/index'],
}),
]
plugins.forEach(i => config.plugins.push(i));
config.devtool = 'source-map';
config.devServer = {
// contentBase:'/app/',
port: 7777,
host: 'localhost',
historyApiFallback: true,
}
module.exports = config;