-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.headless.mjs
48 lines (40 loc) · 1.38 KB
/
rollup.config.headless.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
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import typescript from '@rollup/plugin-typescript';
export default () => {
let build = {
// Our game entry point (edit as required)
input: ['./src/headless.ts'],
// Where the build file is to be generated.
// Most games being built for distribution can use iife as the module type.
// You can also use 'umd' if you need to ingest your game into another system.
// If using Phaser 3.21 or **below**, add: `intro: 'var global = window;'` to the output object.
output: {
file: './dist/headless.js',
name: 'MyGame',
format: 'cjs',
sourcemap: true
},
external: ['xml2js'],
plugins: [
// Toggle the booleans here to enable / disable Phaser 3 features:
replace({
preventAssignment: true,
'INCLUDE_GRAPHICS: true': 'INCLUDE_GRAPHICS: false'
}),
// Parse our .ts source files
nodeResolve({
extensions: ['.ts', '.tsx']
}),
// We need to convert the Phaser 3 CJS modules into a format Rollup can use:
commonjs({
sourceMap: true,
ignoreGlobal: true
}),
// See https://github.com/rollup/plugins/tree/master/packages/typescript for config options
typescript()
]
};
return build;
};