-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
/
webpack.config.js
73 lines (72 loc) · 2.13 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const path = require("path");
const fs = require("fs");
const {
Compilation,
sources: { RawSource }
} = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
output: {
library: {
type: "module"
}
},
target: ["web", "es2020"],
experiments: {
outputModule: true
},
plugins: [
{
apply(compiler) {
compiler.hooks.compilation.tap("html-plugin", compilation => {
compilation.hooks.processAssets.tap(
{
name: "copy-plugin",
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
},
() => {
[
"static-package.json",
"static-package-str.json",
"static-package-with.json",
"static-package-str-with.json",
"dynamic-package.json",
"dynamic-package-str.json",
"dynamic-package-with.json",
"dynamic-package-str-with.json",
"eager.json",
"weak.json",
"./nested/pkg.json",
"./re-export-assert.json",
"./re-export-with.json"
].forEach(filename => {
const resolvedFilename = path.resolve(__dirname, filename);
const content = fs.readFileSync(resolvedFilename);
compilation.emitAsset(
filename.replace(/\.\/nested\//, ""),
new RawSource(content)
);
});
}
);
});
}
}
],
externals: {
"./static-package.json": "module ./static-package.json",
"./static-package-str.json": "module ./static-package-str.json",
"./static-package-with.json": "module ./static-package-with.json",
"./static-package-str-with.json": "module ./static-package-str-with.json",
"./dynamic-package.json": "import ./dynamic-package.json",
"./dynamic-package-str.json": "import ./dynamic-package-str.json",
"./dynamic-package-with.json": "import ./dynamic-package-with.json",
"./dynamic-package-str-with.json": "import ./dynamic-package-str-with.json",
"./eager.json": "import ./eager.json",
"./weak.json": "import ./weak.json",
"./pkg.json": "import ./pkg.json",
"./pkg": "import ./pkg",
"./re-export-assert.json": "module ./re-export-assert.json",
"./re-export-with.json": "module ./re-export-with.json"
}
};