-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
80 lines (79 loc) · 1.88 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
74
75
76
77
78
79
80
const webpack = require('webpack')
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: {
index: ['./node_modules/hidpi-canvas/dist/hidpi-canvas.min.js', './app/index.ts'],
pie: './app/example/pie.ts',
bar: './app/example/bar.ts',
line: './app/example/line.ts',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
library: 'simple-chart', // 类库名称
libraryTarget: 'umd' // 类库打包方式
},
resolve: {
modules: [path.resolve('node_modules')],
alias: {
'~': path.resolve(__dirname, './app')
},
extensions: ['.js', '.jsx', '.ts']
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: ['ts-loader']
},
{
test: /\.(jpg|png|gif|jpeg|bmp|eot|svg|ttf|woff|woff2)$/,
use: {
loader: 'url-loader',
options: {
limit: 20 * 1024,
outputPath: './',
}
}
}
]
},
watch: true,
watchOptions: {
poll: 2000, //每秒问我多少次
aggregateTimeout: 1000, //防抖
ignored: /node_modules|vendor|build|public|resources/
},
plugins: [
new HtmlWebpackPlugin({
template: './app/index.html',
chunks: ['index', 'pie'],
filename: './example/pie.html'
}),
new HtmlWebpackPlugin({
template: './app/index.html',
chunks: ['index', 'bar'],
filename: './example/bar.html'
}),
new HtmlWebpackPlugin({
template: './app/index.html',
chunks: ['index', 'line'],
filename: './example/line.html'
})
],
devServer: {
port: 8080,
progress: true,
contentBase: './build',
open: true,
//hot: true,
proxy: {
'/mui/src/css': {
target: 'http://project.xuehtml.com',
changeOrigin: true
}
},
}
}