forked from nanxiaobei/antd-img-crop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
24 lines (22 loc) · 847 Bytes
/
rollup.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
import replace from '@rollup/plugin-replace';
import babel from 'rollup-plugin-babel';
import less from 'rollup-plugin-less';
import pkg from './package.json';
const input = 'src/index.jsx';
const external = (id) => !/index.less$/.test(id);
const plugins = (isEsm) => [
!isEsm && replace({ '/es/': '/lib/' }),
babel({
presets: [
['@babel/preset-env', { targets: '> 0.25%, not dead', modules: false, loose: true }],
['@babel/preset-react', { useBuiltIns: true }],
],
plugins: [['@babel/plugin-transform-runtime', { useESModules: isEsm }]],
runtimeHelpers: true,
}),
less({ insert: true, output: false }),
];
export default [
{ input, output: { file: pkg.main, format: 'cjs' }, external, plugins: plugins(false) },
{ input, output: { file: pkg.module, format: 'es' }, external, plugins: plugins(true) },
];