-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
69 lines (67 loc) · 1.63 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
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import { eslint } from 'rollup-plugin-eslint';
import { generateSW } from 'rollup-plugin-workbox';
import json from '@rollup/plugin-json';
import manifest from 'rollup-plugin-manifest-json';
import postcss from 'rollup-plugin-postcss';
import resolve from '@rollup/plugin-node-resolve';
import riot from 'rollup-plugin-riot';
import { terser } from 'rollup-plugin-terser';
import pkg from './package.json';
var root = pkg.root;
var resconf = { browser: true };
var eslintconf = {
exclude: [ 'node_modules/**' ],
};
export default {
input: 'src/main.js',
output: [
{
file: pkg.browser,
format: 'cjs',
sourcemap: true
}
],
plugins: [
riot(),
resolve( resconf ),
eslint( eslintconf ),
commonjs(),
json(),
terser(),
copy( {
targets: [
{ src: 'index.html', dest: 'dist' },
{ src: 'favicon/*', dest: 'dist' },
]
} ),
manifest( {
input: 'manifest.json',
manifest: {
name: pkg.name,
short_name: pkg.name,
description: pkg.description,
categories: pkg.keywords,
scope: root,
start_url: root
},
minify: true
} ),
postcss({
extract: true,
plugins: [
require('postcss-import')({}),
require('cssnano')({
preset: 'default',
}),
]
}),
generateSW({
swDest: 'dist/sw.js',
globDirectory: 'dist',
globPatterns: [ 'bundle.*', '*.png', '*.ico', '*.svg', '*.xml', '*.html', '*.json' ],
modifyURLPrefix: { '': pkg.root },
}),
]
}