-
Notifications
You must be signed in to change notification settings - Fork 9
/
rollup.config.js
51 lines (46 loc) · 1.11 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
import jscc from 'rollup-plugin-jscc'
import license from 'rollup-plugin-license'
import pkg from './package.json'
import {uglify} from 'rollup-plugin-uglify'
import browsersync from 'rollup-plugin-browsersync'
const isWatching = process.argv.includes('-w') || process.argv.includes('--watch')
const plugins = [
jscc({values: {_WIDGET_VERSION: pkg.widgetVersion}}),
license({
banner: `
<%= pkg.name %> <%= pkg.version %>
<%= pkg.description %>
<%= pkg.homepage %>
Date: <%= moment().format('YYYY-MM-DD') %>
`,
}),
isWatching && browsersync(),
]
const globals = {
jQuery: 'window.jQuery',
Redactor: 'window.Redactor',
RedactorX: 'window.RedactorX',
}
const external = ['jQuery', 'Redactor', 'RedactorX']
export default [
{
input: 'src/uploadcare.js',
plugins,
external,
output: {
file: 'dist/uploadcare.redactor.js',
format: 'iife',
globals,
},
},
{
input: 'src/uploadcare.js',
plugins: [uglify(), ...plugins],
external,
output: {
file: 'dist/uploadcare.redactor.min.js',
format: 'iife',
globals,
},
},
]