forked from gdg-x/hoverboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
75 lines (70 loc) · 1.81 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
72
73
74
75
/* eslint-env node */
import { createSpaConfig } from '@open-wc/building-rollup';
import merge from 'deepmerge';
import copy from 'rollup-plugin-copy';
import replace from 'rollup-plugin-re';
import { workboxConfig } from './workbox-config';
const { production, compileTemplate, compileBufferTemplate } = require('./build-utils.js');
if (!production) {
throw new Error('build only supports NODE_ENV=production');
}
const baseConfig = createSpaConfig({
html: {
transform: (html) => compileTemplate(html),
},
workbox: workboxConfig,
});
export default merge(baseConfig, {
input: './index.html',
plugins: [
replace({
exclude: 'node_modules/**',
patterns: [
{
transform: (code, _path) => compileTemplate(code),
},
],
}),
copy({
targets: [
{
src: 'images/',
dest: 'dist/',
},
{
src: 'manifest.json',
dest: 'dist',
transform: compileBufferTemplate,
},
{
src: 'node_modules/@webcomponents/webcomponentsjs/*.{js,map}',
dest: 'dist/node_assets/@webcomponents/webcomponentsjs',
},
{
src: 'node_modules/firebase/*.{js,map}',
dest: 'dist/node_assets/firebase/',
},
{
src: 'out-tsc/src/service-worker-registration.js',
dest: 'dist/src',
transform: compileBufferTemplate,
},
{
src: 'firebase-messaging-sw.js',
dest: 'dist',
transform: compileBufferTemplate,
},
{
src: 'data/*.md',
dest: 'dist/data',
transform: compileBufferTemplate,
},
{
src: 'data/posts/*.md',
dest: 'dist/data/posts',
transform: compileBufferTemplate,
},
],
}),
],
});