-
Notifications
You must be signed in to change notification settings - Fork 9
/
tsdx.config.js
39 lines (33 loc) · 921 Bytes
/
tsdx.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
const workerLoader = require("rollup-plugin-web-worker-loader");
const url = require("@rollup/plugin-url");
module.exports = {
// This function will run for each entry/format/env combination
rollup(config, options) {
config.plugins.unshift(
url({
include: ["**/*.wasm"],
limit: 9999999,
emitFiles: false,
})
);
config.plugins.push(
// https://github.com/darionco/rollup-plugin-web-worker-loader
workerLoader({
targetPlatform: "browser",
extensions: [".js", ".ts"],
external: [],
sourcemap: true,
})
);
// prevent web worker from being ignored
const oldExternal = config.external;
config.external = (id) => {
if (id.startsWith("web-worker:")) {
return false;
}
return oldExternal(id);
};
console.log("rollup config: ", config, options);
return config;
},
};