-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
64 lines (63 loc) · 1.65 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
import { terser } from 'rollup-plugin-terser'
import glsl from 'rollup-plugin-glsl'
import buble from '@rollup/plugin-buble'
export default [
// First compile to an iife, and wrap the whole thing into an exported factory function.
// This ensures all the code is self-contained within that one factory function.
{
input: 'src/index.js',
output: {
file: 'dist/index.js',
format: 'iife',
name: 'exports',
banner: `export default function SDFGenerator() {`,
footer: `return exports\n}`
},
plugins: [
glsl({
include: '**/*.glsl',
compress: true
}),
// Transpile down to ES5 for all build artifacts. This helps ensure that downstream
// transpilers won't inject references to external helpers/polyfills, which would
// break its ability to be serialized to a web worker.
buble()
]
},
// Then wrap that exported factory function as esm and umd
{
input: 'dist/index.js',
output: [
{
file: 'dist/webgl-sdf-generator.mjs',
format: 'esm'
},
{
file: 'dist/webgl-sdf-generator.min.mjs',
format: 'esm',
plugins: [
terser({
ecma: 5,
//mangle: {properties: {regex: /^_/}}
})
]
},
{
file: 'dist/webgl-sdf-generator.js',
format: 'umd',
name: 'webgl_sdf_generator'
},
{
file: 'dist/webgl-sdf-generator.min.js',
format: 'umd',
name: 'webgl_sdf_generator',
plugins: [
terser({
ecma: 5,
//mangle: {properties: {regex: /^_/}}
})
]
}
]
}
]