forked from hirosystems/connect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsdx.config.js
30 lines (27 loc) · 950 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
// eslint-disable-next-line @typescript-eslint/no-var-requires
const peerDepsExternal = require('rollup-plugin-peer-deps-external');
const esbuild = require('rollup-plugin-esbuild');
const path = require('path');
module.exports = {
rollup(config, options) {
config.plugins = config.plugins.map(plugin => {
if (plugin && plugin.name === 'rpt2') {
return esbuild({
minify: process.env.NODE_ENV === 'production',
target: 'esnext',
jsxFactory: 'React.createElement',
jsxFragment: 'React.Fragment',
tsconfig: path.resolve('./tsconfig.json'),
});
}
return plugin;
});
config.plugins.push(peerDepsExternal());
if (options.format === 'esm') {
config = { ...config, preserveModules: true };
config.output = { ...config.output, dir: 'dist/', entryFileNames: '[name].esm.js' };
delete config.output.file;
}
return config;
},
};