-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
49 lines (42 loc) · 1.1 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
import vue from 'rollup-plugin-vue';
import buble from 'rollup-plugin-buble';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import { rollup } from 'rollup';
import clone from 'lodash/cloneDeep';
import { default as vueConfig, pack } from './config/rollup-plugin-vue.config';
import bubleConfig from './config/buble.config';
let cache;
const config = {
entry: 'src/main.js',
targets: [
{ format: 'es', dest: `dist/${pack.name}.js` },
{ format: 'cjs', dest: `dist/${pack.name}.common.js` },
],
plugins: [
vue(vueConfig),
buble(bubleConfig),
],
useStrict: false,
cache,
};
// --- DO NOT CHANGE BEYOND THIS ---
if (vueConfig.standalone) {
const options = clone(config);
options.entry = 'src/main.js';
options.targets = [];
options.plugins = [
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
].concat(options.plugins);
rollup(options).then((bundle) => bundle.write({
format: 'iife',
dest: `dist/${pack.name}.min.js`,
moduleName: pack.name,
}));
}
export default config;