-
Notifications
You must be signed in to change notification settings - Fork 65
/
rollup.config.js
44 lines (39 loc) · 1.01 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
import includePaths from 'rollup-plugin-includepaths';
import commonjs from '@rollup/plugin-commonjs';
const BUNDLE = process.env.BUNDLE === 'true'
const ESM = process.env.ESM === 'true'
const fileDest = `spotlight${ESM ? '.esm' : ''}`
const external = [
'blacklight-frontend',
'clipboard',
'jquery-serializejson',
'jquery',
'leaflet',
'sir-trevor'
]
const globals = {
'blacklight-frontend': 'Blacklight',
clipboard: 'Clipboard',
jquery: 'jQuery',
leaflet: 'L',
'sir-trevor': 'SirTrevor'
}
let includePathOptions = {
include: {},
paths: ['app/javascript', 'vendor/assets/javascripts'],
external: [],
extensions: ['.js', '.es6']
};
const rollupConfig = {
input: 'app/javascript/spotlight/index.js',
output: {
file: `app/assets/javascripts/spotlight/${fileDest}.js`,
format: ESM ? 'es' : 'umd',
globals,
generatedCode: { preset: 'es2015' },
name: ESM ? undefined : 'Spotlight'
},
external,
plugins: [includePaths(includePathOptions), commonjs()]
}
export default rollupConfig