-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.shared.js
62 lines (60 loc) · 1.38 KB
/
webpack.shared.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
const path = require("path");
const { DefinePlugin } = require("webpack");
let { VERSION, VERSION_READABLE } = process.env;
VERSION = VERSION || -1;
VERSION_READABLE = VERSION_READABLE || "unversioned";
module.exports = {
workerConfig() {
const audit = process.env.AUDIT;
if (!audit) {
throw new Error(
"Specify the AUDIT env variable to let me know which audit you want to use. Audits exist in REPO_ROOT/audits/ folder. e.g. you can use local as the audit name"
);
}
return {
target: "webworker",
entry: "./src/worker/index.js",
optimization: {
minimize: false,
},
module: {
rules: [
{
test: /\.txt|\.html$/i,
use: "raw-loader",
},
],
},
resolve: {
alias: {
Audit: path.resolve(__dirname, `audits/${audit}`),
},
},
plugins: [
new DefinePlugin({
__VERSION__: VERSION,
__VERSION_READABLE__: JSON.stringify(VERSION_READABLE),
}),
],
};
},
injectConfig() {
return {
entry: "./src/worker/inject.js",
optimization: {
minimize: false
},
output: {
filename: 'inject.js'
},
module: {
rules: [
{
test: /\.txt|\.html$/i,
use: "raw-loader",
},
],
},
};
}
};