-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup-base.config.js
53 lines (52 loc) · 1.22 KB
/
rollup-base.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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import external_globals from 'rollup-plugin-external-globals';
import externals from 'rollup-plugin-node-externals';
import { string } from 'rollup-plugin-string';
export default (typescript) => [{
input: './src/ts/index.ts',
plugins: [
string({
include: "**/*.glsl"
}),
resolve({
browser: true
}),
commonjs(),
typescript(),
external_globals({
'three': 'THREE',
'./declarations/oimo': 'OIMO',
'../declarations/oimo': 'OIMO'
})
],
output: {
format: 'iife',
file: './src/js/bundle.js',
name: '', // Empty string here to create an unnamed IIFE
banner: '(function iife() {',
footer: '})()'
},
onwarn: function (message) {
if (message.code === 'CIRCULAR_DEPENDENCY' || message.code === "MISSING_GLOBAL_NAME") {
return;
}
console.warn(message);
}
}, {
input: './server/ts/index.ts',
plugins: [
externals(),
typescript()
],
output: {
format: 'cjs',
file: './server/bundle.js'
},
onwarn: function (message) {
if (message.code === 'CIRCULAR_DEPENDENCY' || message.code === "MISSING_GLOBAL_NAME" || message.code === "UNRESOLVED_IMPORT") {
return;
}
console.warn(message);
}
}];