forked from microsoft/agent-governance-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
68 lines (67 loc) · 1.7 KB
/
webpack.config.js
File metadata and controls
68 lines (67 loc) · 1.7 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
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
popup: './src/popup/index.tsx',
options: './src/options/index.tsx',
background: './src/background/service-worker.ts',
'content/github': './src/content/github.ts',
'content/jira': './src/content/jira.ts',
'content/aws': './src/content/aws.ts',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
clean: true,
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
plugins: [
new CopyPlugin({
patterns: [
{ from: 'manifest.json', to: 'manifest.json' },
{ from: 'icons', to: 'icons' },
// Keep legacy files during migration
{ from: 'devtools', to: 'devtools' },
],
}),
new HtmlWebpackPlugin({
template: './src/popup/popup.html',
filename: 'popup.html',
chunks: ['popup'],
}),
new HtmlWebpackPlugin({
template: './src/options/options.html',
filename: 'options.html',
chunks: ['options'],
}),
],
optimization: {
splitChunks: {
chunks: (chunk) => {
// Don't split background or content scripts
return !['background', 'content/github', 'content/jira', 'content/aws'].includes(chunk.name);
},
},
},
};