-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtsdx.config.js
More file actions
32 lines (28 loc) · 839 Bytes
/
tsdx.config.js
File metadata and controls
32 lines (28 loc) · 839 Bytes
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
// see: https://github.com/formium/tsdx#rollup
// TODO: track https://github.com/formium/tsdx/issues/961 for possible better solution
const path = require("path");
const relativePath = p => path.join(__dirname, p);
module.exports = {
rollup(config, options) {
if (options.format === "esm") {
// we use this to output separate chunk for /src/validators
// see: https://stackoverflow.com/a/65173887
return {
...config,
input: [
relativePath("src/index.ts"),
relativePath("src/validators/index.ts"),
],
output: {
...config.output,
file: undefined,
dir: relativePath("dist/esm"),
preserveModules: true,
preserveModulesRoot: relativePath("src"),
},
};
} else {
return config;
}
},
};