-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
56 lines (55 loc) · 1.67 KB
/
Copy pathwebpack.config.js
File metadata and controls
56 lines (55 loc) · 1.67 KB
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
// webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './framework/main.ts', // Entry point for the TypeScript file
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'lib'),
clean: true
},
resolve: {
extensions: ['.ts', '.js'], // Resolve both .ts and .js extensions
},
module: {
rules: [
{
test: /\.ts$/, // Apply this rule to .ts files
use: 'ts-loader', // Use ts-loader to transpile TypeScript
exclude: /node_modules/,
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: 'index_template.html', // Path to your HTML file template
filename: '../index.html',
inject: 'body', // Inject scripts at the bottom of the body
}),
],
optimization: {
splitChunks: {
chunks: 'all',
minSize: 30000, // Set a lower minimum chunk size
maxSize: 200000, // Set a smaller maximum chunk size
automaticNameDelimiter: '-',
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
priority: -10
},
default: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
},
},
},
},
performance: {
maxAssetSize: 244000, // Set the asset size limit to 250KiB
},
mode: 'production',
};