-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.mjs
57 lines (56 loc) · 1.31 KB
/
rollup.config.mjs
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
import path from 'path';
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
export default [
// Unminified version
{
input: 'src/app.js', // Entry point of your library
output: {
file: path.resolve('dist', 'p5.sound.js'),
format: 'iife', // Change to IIFE format
},
plugins: [
resolve(),
terser({
compress: {
dead_code: true,
drop_debugger: true,
conditionals: true,
evaluate: true,
booleans: true,
loops: true,
unused: true,
hoist_funs: true,
keep_fargs: true,
hoist_vars: false,
if_return: true,
join_vars: false,
side_effects: true,
warnings: false
},
mangle: false,
format: {
beautify: true,
comments: true,
indent_level: 2,
wrap_iife: true
}
}),
],
treeshake: {
preset: 'recommended',
}
},
// Minified version
{
input: 'src/app.js', // Entry point of your library
output: {
file: path.resolve('dist', 'p5.sound.min.js'),
format: 'iife', // Change to IIFE format
},
plugins: [
resolve(), // Resolves node_modules
terser(), // Minify the output
],
}
];