forked from uploadcare/uploadcare-widget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
68 lines (55 loc) · 1.56 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
66
67
68
import babel from 'rollup-plugin-babel'
import jst from 'rollup-plugin-jst'
import json from 'rollup-plugin-json'
import commonjs from 'rollup-plugin-commonjs'
import resolve from 'rollup-plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
const bundle = (input, output, options = {}) => ({
input: `src/build/${input}`,
output: {
name: 'uploadcare',
format: 'umd',
file: `dist/${output}`,
globals: options.includeJquery
? undefined
: {
jquery: '$'
}
},
external: options.includeJquery ? undefined : ['jquery'],
plugins: [
babel({
exclude: 'node_modules/**',
presets: [['@babel/env', { modules: false }]]
}),
jst({
templateOptions: {
variable: 'ext'
},
minify: true,
minifyOptions: {
collapseWhitespace: true
},
escapeModule: 'escape-html'
}),
json(),
resolve(),
commonjs(),
terser({
compress: {
passes: 2 // https://github.com/terser/terser/issues/453
},
include: [/^.+\.min\.js$/]
})
]
})
export default [
bundle('uploadcare.api.js', 'uploadcare.api.js'),
bundle('uploadcare.api.js', 'uploadcare.api.min.js'),
bundle('uploadcare.js', 'uploadcare.js'),
bundle('uploadcare.js', 'uploadcare.min.js'),
bundle('uploadcare.lang.en.js', 'uploadcare.lang.en.js'),
bundle('uploadcare.lang.en.js', 'uploadcare.lang.en.min.js'),
bundle('uploadcare.full.js', 'uploadcare.full.js', { includeJquery: true }),
bundle('uploadcare.full.js', 'uploadcare.full.min.js', { includeJquery: true })
]