This repository has been archived by the owner on May 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
59 lines (49 loc) · 1.98 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
/* eslint-disable */
import merge from 'deepmerge';
// use createSpaConfig for bundling a Single Page App
import { createSpaConfig } from '@open-wc/building-rollup';
const workboxConfig = require('./workbox-config.js');
const { generateSW } = require('rollup-plugin-workbox');
import copy from 'rollup-plugin-copy';
// use createBasicConfig to do regular JS to JS bundling
// import { createBasicConfig } from '@open-wc/building-rollup';
const baseConfig = createSpaConfig({
// use the outputdir option to modify where files are output
// outputDir: 'dist',
// if you need to support older browsers, such as IE11, set the legacyBuild
// option to generate an additional build just for this browser
// legacyBuild: true,
// development mode creates a non-minified build for debugging or development
developmentMode: process.env.ROLLUP_WATCH === 'true',
// set to true to inject the service worker registration into your index.html
injectServiceWorker: false,
// we use a separate workbox config (workbox-config.js)
workbox: false,
});
const copyConf = merge(baseConfig, {
plugins: [
copy({
targets: [
{ src: 'assets/**/*', dest: 'dist/assets' },
{ src: 'src/configs/flowConfig.json', dest: 'dist/src' },
{ src: 'manifest.json', dest: 'dist' },
{ src: 'favicon.ico', dest: 'dist' },
{ src: 'robots.txt', dest: 'dist' },
],
// set flatten to false to preserve folder structure
flatten: false,
}),
],
// alternatively, you can use your JS as entrypoint for rollup and
// optionally set a HTML template manually
// input: './app.js',
});
export default merge(copyConf, {
// if you use createSpaConfig, you can use your index.html as entrypoint,
// any <script type="module"> inside will be bundled by rollup
input: './index.html',
plugins: [generateSW(workboxConfig)],
// alternatively, you can use your JS as entrypoint for rollup and
// optionally set a HTML template manually
// input: './app.js',
});