-
Notifications
You must be signed in to change notification settings - Fork 59
/
rollup.config.js
51 lines (47 loc) · 1.51 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 merge from 'deepmerge'
import copy from 'rollup-plugin-copy'
import {createSpaConfig} from '@open-wc/building-rollup'
import replace from '@rollup/plugin-replace'
import versionInjector from 'rollup-plugin-version-injector'
const API_URL = process.env.API_URL === undefined ? '' : process.env.API_URL
const BASE_DIR = process.env.BASE_DIR === undefined ? '' : process.env.BASE_DIR
const baseConfig = createSpaConfig({
developmentMode: process.env.ROLLUP_WATCH === 'true',
injectServiceWorker: true,
workbox: {
globIgnores: ['index.html'],
navigateFallbackDenylist: [/^\/api.*/],
skipWaiting: false,
clientsClaim: false,
},
html: {
transform: [
html => html.replace('<base href="/">', `<base href="${BASE_DIR}/">`),
],
},
})
export default merge(baseConfig, {
input: './index.html',
external: ['./config.js'],
plugins: [
copy({
targets: [
{src: './L.Control.Locate.min.css', dest: 'dist/'},
{src: './tippy.css', dest: 'dist/'},
{src: './leaflet.css', dest: 'dist/'},
{src: './config.js', dest: 'dist/'},
{src: './manifest.json', dest: 'dist/'},
{src: './images/**/*', dest: 'dist/images'},
{src: './fonts/**/*', dest: 'dist/fonts'},
{src: './lang/*', dest: 'dist/lang'},
],
}),
replace({
'http://localhost:5555': API_URL,
BASE_DIR: JSON.stringify(BASE_DIR),
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify('production'),
}),
versionInjector(),
],
})