-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.config.js
65 lines (60 loc) · 1.59 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
58
59
60
61
62
63
64
65
import babel from '@rollup/plugin-babel';
import vue from 'rollup-plugin-vue';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { uglify } from 'rollup-plugin-uglify';
import css from 'rollup-plugin-css-only';
import pck from './package.json';
const extensions = [
'.js', '.vue'
];
const plugins = [
resolve({ extensions }),
commonjs(),
css({ output: 'vue-gridmultiselect.css' }),
vue({
css: false,
compileTemplate: true,
template: {
isProduction: true
},
normalizer: '~vue-runtime-helpers/dist/normalize-component.js'
}),
babel({
extensions: extensions,
exclude: ['node_modules/**'],
babelHelpers: 'bundled'
})
];
const buildBanner = () => {
return [
'/*!',
'* Vue GridMultiselect v' + pck.version,
'* Copyright ' + pck.author + ' and other contributors',
'* Licensed under ' + pck.license + ' (https://github.com/ProticM/vue-gridmultiselect/blob/master/LICENSE)',
'*/'
].join('\n');
};
const input = 'src/index.js';
const getOutput = (format, isMin) => {
const isUMD = format === 'umd';
return {
file: `dist/vue-gridmultiselect${isMin ? '.min' : ''}${isUMD ? '' : '.esm'}.js`,
format: format,
...isUMD ? { name: 'VueGridMultiselect' } : null,
banner: buildBanner()
};
};
export default [{
input: input,
output: [getOutput('umd', true)],
plugins: plugins.concat(uglify({ output: { comments: "/^!/" } }))
}, {
input: input,
output: [getOutput('umd', false)],
plugins: plugins
}, {
input: input,
output: [getOutput('esm')],
plugins: plugins
}];