-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.dev.config.js
71 lines (70 loc) · 2.02 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
let webpack = require('webpack');
let path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
let BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
let webpackBase = require('./webpack.base.config');
let webpackMerge = require('webpack-merge');
let options = {
cdn: '',
dist: 'sample/dist',
root: __dirname,
src: './src'
}
var config = webpackMerge(webpackBase(options), {
mode: 'development',
entry: {
'index': path.resolve(options.root, 'sample', 'index.tsx'),
},
output: {
filename: '[name].js',
chunkFilename: '[name].chunk.js'
},
devServer: {
contentBase: './sample',
},
// optimization: {
// splitChunks: {
// cacheGroups: {
// styles: {
// name: 'styles',
// test: /\.less$|\.css$/,
// chunks: 'all',
// enforce: true
// }
// }
// }
// },
externals: [
{
// 'react': 'React',
// 'react-dom': 'ReactDOM',
// 'react-redux': 'ReactRedux',
// 'redux': 'Redux',
// 'immutable': 'Immutable',
// 'jquery': 'jQuery',
// 'esprima-fb': 'esprima',
// 'draft-js': 'Draft',
// 'lodash': '_',
// 'react-router-dom': 'ReactRouterDOM'
},
],
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
new HtmlWebpackPlugin({
template:path.resolve(options.root,'sample/tmp.html'),
title: '属性编辑器',
}),
new MiniCssExtractPlugin({
filename: "[name].css",
}),
new BundleAnalyzerPlugin({
analyzerPort: 9999
})
],
devtool: 'inline-source-map',
});
console.log(config)
module.exports = config;