forked from tinymce/tinymce-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.build.js
34 lines (31 loc) · 767 Bytes
/
rollup.build.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
const rollup = require('rollup');
const typescript = require('rollup-plugin-typescript2');
const { uglify } = require('rollup-plugin-uglify');
const browserBuildOptions = {
file: 'lib/browser/tinymce-vue.js',
format: 'iife',
name: 'Editor',
globals: {
vue: 'Vue'
}
};
const build = async (input, output) => {
const bundle = await rollup.rollup(input);
await bundle.write(output);
};
[
browserBuildOptions,
{ ...browserBuildOptions,
file: 'lib/browser/tinymce-vue.min.js'
}
].forEach((opts) => build({
input: './src/main/ts/index.ts',
plugins: [
typescript({
tsconfig: './tsconfig.browser.json'
}),
opts.file.endsWith('min.js') ? uglify() : {}
]
}, opts).then(
() => console.log(`bundled: ${opts.file}`))
);