forked from cmda-minor-web/meesterproef-1920
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
61 lines (60 loc) · 1.87 KB
/
rollup.config.js
File metadata and controls
61 lines (60 loc) · 1.87 KB
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
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import autoprefixer from 'autoprefixer';
import cssnano from 'cssnano';
import postcss from 'rollup-plugin-postcss';
import copy from 'rollup-plugin-copy';
import del from 'rollup-plugin-delete'
import babel from '@rollup/plugin-babel';
import { terser } from "rollup-plugin-terser";
import manifestJson from "rollup-plugin-manifest-json";
const { injectManifest } = require('rollup-plugin-workbox');
export default {
input: ['src/js/main.js', 'src/js/nests.js'],
output: {
dir: 'public',
format: 'cjs',
sourcemap: true,
},
treeshake: true,
plugins: [
del({targets: 'public/*'}),
resolve({
main: true,
browser: true
}),
commonjs(),
babel({ babelHelpers: 'bundled' }),
terser(),
postcss({
preprocessor: (content, id) => new Promise((resolve, reject) => {
const result = sass.renderSync({ file: id })
resolve({ code: result.css.toString() })
}),
plugins: [
autoprefixer,
cssnano
],
sourceMap: true,
extract: 'styles.css',
extensions: ['.scss','.css']
}),
copy({
targets: [
{ src: 'src/images/icons/*', dest: 'public/icons' }
]
}),
injectManifest({
swSrc: 'src/js/sw.js',
swDest: 'public/sw.js',
globDirectory: 'public/',
}, ({ swDest, count, size }) => {
console.log(`${swDest} Generated`);
console.log(`The service worker will precache ${count} URLs, totaling ${size}`);
}),
manifestJson({
input: "src/manifest.json", // Required
minify: true
})
]
}