-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
rollup.config.js
71 lines (69 loc) · 2.24 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
69
70
71
import resolve from '@rollup/plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import copy from 'rollup-plugin-copy';
import replace from '@rollup/plugin-replace';
import { terser } from 'rollup-plugin-terser';
const production = process.env.BUILD === 'production';
/*
* Creates a new set of bundles which can replace the bundled version
* in TEI Publisher or an app generated from it. Unfortunately it is
* not possible to create a minimal bundle with just the new components.
*/
export default {
input: [
'@teipublisher/pb-components/src/pb-components-bundle.js',
'@teipublisher/pb-components/src/pb-leaflet-map.js',
'@teipublisher/pb-components/src/pb-odd-editor.js',
'@teipublisher/pb-components/src/pb-edit-app.js',
'./pb-extension-bundle.js'
],
output: {
dir: 'dist',
format: 'es',
sourcemap: !production
},
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production')
}),
babel({
"plugins": [
"@babel/plugin-proposal-object-rest-spread"
]
}),
resolve(),
production && terser({
compress: {
reduce_vars: false
}
}),
copy({
targets: [
{
src: './node_modules/leaflet/dist/leaflet.css',
dest: './css/leaflet'
},
{
src: './node_modules/leaflet/dist/images/*',
dest: './images/leaflet'
},
{
src: './node_modules/openseadragon/build/openseadragon/images/*',
dest: './images/openseadragon'
},
{
src: './node_modules/openseadragon/build/openseadragon/openseadragon.min.js',
dest: './lib/'
},
{
src: './node_modules/prismjs/themes/*',
dest: './css/prismjs'
},
{
src: './node_modules/@teipublisher/pb-components/i18n/common/*',
dest: './i18n/common'
}
]
})
]
}