-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.build.js
85 lines (81 loc) · 1.72 KB
/
rollup.config.build.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
76
77
78
79
80
81
82
83
84
85
import { terser } from "rollup-plugin-terser";
import html from 'rollup-plugin-html2';
import image from 'rollup-plugin-img';
import { string } from "rollup-plugin-string";
import stripCode from "rollup-plugin-strip-code";
import copy from 'rollup-plugin-copy';
import nodeResolve from '@rollup/plugin-node-resolve';
import kontra from 'rollup-plugin-kontra'
import rollupPluginES6ClassMinify from 'rollup-plugin-es6-class-minify';
const options = {
toplevel: true,
mangle: {
properties: false,
keep_fnames: false,
},
compress: {
passes: 5,
unsafe: true,
pure_getters: true,
},
ecma: 6, // specify one of: 5, 6, 7 or 8
// keep_classnames: false,
keep_fnames: false,
// ie8: false,
// module: false,
// nameCache: null, // or specify a name cache object
// safari10: false,
// // toplevel: false,
// warnings: false,
};
const plugins = [
nodeResolve(),
terser(options),
html({
template: 'src/index.html',
dest: "docs",
inject: 'body',
}),
image({
limit: 10000
}),
string({
include: ['**/*.frag', '**/*.vert'],
}),
stripCode({
start_comment: 'start-test-code',
end_comment: 'end-test-code'
}),
kontra({
gameObject: {
rotation: true,
}
}),
rollupPluginES6ClassMinify(),
// kontra({
// gameObject: {
// acceleration: false,
// camera: false,
// opacity: false,
// }
// }),
];
module.exports = [
{
input: 'src/main.js',
output: {
file: 'docs/bundle.js',
format: 'cjs',
// sourcemap: 'inline',
},
treeshake: true,
plugins: [
...plugins,
// copy({
// targets: [
// { src: 'src/favicon.ico', dest: 'docs' },
// ]
// })
],
},
];