-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollupOptions.mjs
44 lines (43 loc) · 1.34 KB
/
rollupOptions.mjs
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
import { babel } from '@rollup/plugin-babel';
import browserTargets from './browserTargets.mjs';
export default {
// Externalize peerDependencies
external: (id) =>
['vue', 'core-js', '@rei/cdr-tokens', 'tabbable'].some(
(dep) => dep === id || id.startsWith(`${dep}/`),
),
output: {
globals: {
vue: 'Vue',
},
preserveModules: true,
assetFileNames: (assetInfo) => {
if (assetInfo.name === 'style.css') return 'cdr-style.css';
return assetInfo.name;
},
},
plugins: [
babel({
exclude: ['node_modules/**'],
babelHelpers: 'bundled',
babelrc: false,
extensions: ['.js', '.ts', '.mjs', '.vue'],
targets: browserTargets,
presets: [
[
'@babel/preset-env',
{
modules: false, // don't convert ESM modules, as that breaks tree shaking
targets: browserTargets, // polyfill based on supported browsers
corejs: {
// use corejs@3 for polyfills
version: '3.26', // see https://github.com/zloirock/core-js#babelpreset-env
},
useBuiltIns: 'usage', // polyfill based on usage in source code.
bugfixes: true, // See https://github.com/babel/babel/issues/13916 (note, we can remove this when Babel 8 is released.
},
],
],
}),
],
};