-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsdx.config.js
51 lines (44 loc) · 1.35 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Not transpiled with TypeScript or Babel, so use plain Es6/Node.js!
const ts = require('@wessberg/rollup-plugin-ts');
const visualizer = require('rollup-plugin-visualizer');
const copy = require('rollup-plugin-copy');
const now = new Date(Date.now());
const config = {
// This function will run for each entry/format/env combination
rollup(config, options) {
const { plugins } = config;
// swap out rollup-plugin-typescript2
config.plugins = plugins.map(plugin => {
if (plugin && plugin.name === 'rpt2') {
return ts({
tsconfig: tsconfig => {
return {
...tsconfig,
target: 'ESNext',
sourceMap: true,
declaration: true,
open: true,
};
},
transpiler: 'babel',
});
}
return plugin;
});
config.plugins.push(
visualizer({
filename: `buildStats.html`,
title: `${options.name} Rollup Report (${now.toDateString()})`,
template: 'circlepacking',
sourcemap: true,
}),
copy({
targets: [{ src: 'src/assets/*', dest: 'dist/assets' }],
// copyOnce: true,
// targets: [{ src: 'src/assets/*', dest: ['dist/assets', 'lib/src/assets'] }],
})
);
return { ...config }; // always return a config.
},
};
module.exports = config;