forked from italia/design-react-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsdx.config.js
39 lines (39 loc) · 987 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
31
32
33
34
35
36
37
38
39
const path = require('path');
const url = require('@rollup/plugin-url');
const svgr = require('@svgr/rollup');
module.exports = {
rollup(config, options) {
const { output, plugins, ...restConfig } = config;
const { file, ...restOutput } = output;
if (output.format === 'umd') {
// maybe push popper in globals?
}
const isDev = options.env === 'development';
// Remove file ref and insert dir to support code splitting
return {
...restConfig,
plugins: [
url(),
svgr({
ref: true,
memo: true,
svgoConfig: {
plugins: [
{ removeViewBox: false },
{ removeAttrs: { attrs: 'g:(stroke|fill):((?!^none$).)*' } }
]
}
}),
...plugins
],
output: {
...restOutput,
dir: path.join(
__dirname,
'dist',
`${isDev ? 'types' : restOutput.format}`
)
}
};
}
};