-
Notifications
You must be signed in to change notification settings - Fork 4
/
tsdx.config.js
35 lines (29 loc) · 1.38 KB
/
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
// Not transpiled with TypeScript or Babel, so use plain Es6/Node.js!
const replace = require("@rollup/plugin-replace");
module.exports = {
// This function will run for each entry/format/env combination
rollup(config, opts) {
// TODO: See https://github.com/formium/tsdx to see if options currently package.json
// Added to workaround deprecation warning in @rollup/plugin-replace about 'preventAssignment' default value change
config.plugins = config.plugins.map(p =>
p.name === "replace"
? replace({ "process.env.NODE_ENV": JSON.stringify(opts.env), preventAssignment: true, })
: p
);
// In order to bundle external deps in UMD format:
// From: https://github.com/formium/tsdx/issues/179
// and: https://github.com/formium/tsdx/issues/898
if (config.output.format === "umd") {
const origExternal = config.external;
config.external = (id) => {
//console.log(id);
//if (id.startsWith("@babylonjs")) return true;
//return origExternal(id);
return false; // Embed all libraries by default
};
//config.output.globals["babylon"] = "BABYLON";
}
// Return final customized config for the plugin
return config;
},
};