-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.js
57 lines (53 loc) · 1.12 KB
/
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import RollupNodeResolve from '@rollup/plugin-node-resolve';
import RollupCommonJS from '@rollup/plugin-commonjs';
import RollupAlias from '@rollup/plugin-alias';
import RollupBabel from 'rollup-plugin-babel';
import RollupVue from 'rollup-plugin-vue';
import pkg from './package.json';
const commonPlugins = [
RollupVue(),
RollupBabel({
runtimeHelpers: true,
extensions: ['.js', '.vue'],
exclude: 'node_modules/**'
}),
RollupAlias({
entries: []
}),
RollupNodeResolve(),
RollupCommonJS()
];
const commonExternal = function(id) {
return (
/^vue/i.test(id) ||
/^@vue\/composition-api/i.test(id) ||
/^lodash/i.test(id) ||
/^axios/i.test(id) ||
/^@babel\/runtime-corejs3/i.test(id)
);
};
const config = [
{
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'cjs'
}
],
plugins: [...commonPlugins],
external: commonExternal
},
{
input: 'src/index.js',
output: [
{
file: pkg.module,
format: 'esm'
}
],
plugins: [...commonPlugins],
external: commonExternal
}
];
export default config;