-
Notifications
You must be signed in to change notification settings - Fork 8
/
rollup.config.js
64 lines (60 loc) · 1.58 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
// rollup.config.js
import image from '@rollup/plugin-image';
import vue from 'rollup-plugin-vue';
import buble from '@rollup/plugin-buble';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import uglify from 'rollup-plugin-uglify-es';
import minimist from 'minimist';
import alias from '@rollup/plugin-alias';
import resolve from '@rollup/plugin-node-resolve';
import url from '@rollup/plugin-url';
// eslint-disable-next-line no-undef
const argv = minimist(process.argv.slice(2));
const config = {
input: './src/wrapper.js',
output: {
name: 'MEWComponent',
exports: 'named',
},
// external: ['@/components/Blockie/Blockie.vue'],
plugins: [
alias({
resolve: ['.js', '.vue', '.css', '.scss', 'mdx'],
entries: [
{
find: '@',
replacement: './src',
},
],
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
commonjs(),
vue({
css: true,
compileTemplate: true,
template: {
isProduction: true,
},
}),
buble({
objectAssign: true,
}),
resolve(),
image(),
url({
// by default, rollup-plugin-url will not handle font files
include: ['**/*.eot', '**/*.svg', '**/*.ttf', '**/*.woff', '**/*.woff2'],
// setting infinite limit will ensure that the files
// are always bundled with the code, not copied to /dist
limit: Infinity,
}),
],
};
// Only minify browser (iife) version
if (argv.format === 'iife') {
config.plugins.push(uglify());
}
export default config;