-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
58 lines (54 loc) · 1.09 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
const webpack = require('webpack')
const { merge } = require('webpack-merge')
const common = {
mode: 'production',
// Do not generate source map
devtool: false,
output: {
path: __dirname + '/dist',
libraryTarget: 'umd',
},
module: {
rules: [
{
test: /\.ts/,
exclude: /node_modules/,
use: {
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
// Limit bundle size to 10 kB, otherwise error
performance: {
hints: 'error',
maxEntrypointSize: 10 * 1024,
},
// Transpile to ES5
target: ['web', 'es5'],
}
/**
* Content script - runs on load of each page
*/
const configContent = merge(common, {
entry: './src/indexContentScript.ts',
output: {
filename: 'content_script.min.js',
},
})
/**
* Page script - injected into the page
*/
const configPage = merge(common, {
entry: './src/indexPageScript.ts',
output: {
filename: 'page_script.min.js',
},
})
module.exports = [configContent, configPage]