forked from binance-chain-npm/honeycomb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsdx.config.js
49 lines (46 loc) · 1.55 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
const visualizer = require('rollup-plugin-visualizer');
const typescript = require('rollup-plugin-typescript2');
const url = require('@rollup/plugin-url');
const svgr = require('@svgr/rollup').default;
const { string } = require('rollup-plugin-string');
const svgrOptions = require('./svgr.config');
module.exports = {
rollup(config, options) {
const tsPluginIndex = config.plugins.findIndex((it) => it.name === 'rpt2');
if (!tsPluginIndex) {
throw new Error('`rollup-plugin-typescript2` was not found in the plugin list');
}
return {
...config,
plugins: [
url({
include: ['**/*.png', '**/*.jpg', '**/*.gif', '**/*.otf', '**/*.svg'],
limit: Infinity,
}),
string({ include: 'node_modules/**/*.css' }),
svgr(svgrOptions),
...config.plugins.slice(0, tsPluginIndex),
typescript({
typescript: require('typescript'),
cacheRoot: `./node_modules/.cache/tsdx/${options.format}/`,
tsconfig: options.tsconfig,
tsconfigDefaults: {
compilerOptions: {
sourceMap: true,
declaration: true,
jsx: 'react',
target: 'es5',
},
},
check: options.transpileOnly === false,
objectHashIgnoreUnknownHack: true,
}),
...config.plugins.slice(tsPluginIndex + 1),
visualizer({
template: 'sunburst',
filename: `stats.${[options.format, options.env].filter((it) => !!it).join('.')}.html`,
}),
],
};
},
};