-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.js
More file actions
35 lines (33 loc) · 888 Bytes
/
rollup.config.js
File metadata and controls
35 lines (33 loc) · 888 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
33
34
35
import {babel} from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser';
/**
* @param {object} [config]
* @param {boolean} [config.minifying]
* @param {"umd"|"esm"} [config.format]
* @returns {import('rollup').RollupOptions}
*/
function getRollupObject ({minifying = false, format = 'umd'} = {}) {
const nonMinified = {
input: 'src/index.js',
output: {
format,
sourcemap: minifying,
file: `dist/index-${format}${minifying ? '.min' : ''}.js`,
name: 'svgEditor'
},
plugins: [
babel({
babelHelpers: 'bundled'
})
]
};
if (minifying) {
// @ts-expect-error - terser module types issue with default export
nonMinified.plugins.push(terser());
}
return nonMinified;
}
export default [
getRollupObject({minifying: true, format: 'umd'}),
getRollupObject({minifying: true, format: 'esm'})
];