-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.ts
72 lines (69 loc) · 1.65 KB
/
webpack.dev.ts
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
import * as webpack from 'webpack';
import * as path from 'path';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
const { InjectManifest } = require('workbox-webpack-plugin');
const appPath = path.resolve(__dirname, 'app');
const outputPath = path.resolve(__dirname, 'wwwroot', 'js');
const config: webpack.Configuration = {
mode: 'development',
devtool: 'inline-source-map',
entry: {
app: path.resolve(appPath, 'index.ts')
},
output: {
filename: '[name].intevent.js',
chunkFilename: '[name].intevent.js',
path: outputPath
},
plugins: [
new InjectManifest({
importWorkboxFrom: 'cdn',
swDest: path.resolve(outputPath, 'sw.intevent.js'),
swSrc: path.resolve(appPath, 'sw.ts')
}),
new BundleAnalyzerPlugin({
analyzerMode: 'server',
analyzerHost: '0.0.0.0',
analyzerPort: 9000
})
],
resolve: {
extensions: ['.tsx', '.ts', '.js', 'jsx']
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader'
},
{
test: /\.tsx?$/,
loaders: ['ts-loader'],
sideEffects: false
},
{
test: /\.(png|svg|jpg|gif)$/,
use: ['file-loader']
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: ['file-loader']
}
]
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /node_modules/,
chunks: 'all',
name: 'vendor',
priority: 10,
enforce: true
}
}
}
}
};
export default config;