Spaces:
Running
Running
import { nodeResolve } from '@rollup/plugin-node-resolve'; | |
import commonjs from '@rollup/plugin-commonjs'; | |
import replace from '@rollup/plugin-replace'; | |
import terser from '@rollup/plugin-terser'; | |
import typescript from '@rollup/plugin-typescript'; | |
export default { | |
// Our games entry point (edit as required) | |
input: [ | |
'./src/index.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/index.js', | |
name: 'MyGame', | |
format: 'iife', | |
sourcemap: false | |
}, | |
plugins: [ | |
// Toggle the booleans here to enable / disable Phaser 3 features: | |
replace({ | |
preventAssignment: true, | |
'typeof CANVAS_RENDERER': JSON.stringify(true), | |
'typeof WEBGL_RENDERER': JSON.stringify(true), | |
'typeof WEBGL_DEBUG': JSON.stringify(false), | |
'typeof EXPERIMENTAL': JSON.stringify(true), | |
'typeof PLUGIN_CAMERA3D': JSON.stringify(false), | |
'typeof PLUGIN_FBINSTANT': JSON.stringify(false), | |
'typeof FEATURE_SOUND': JSON.stringify(true) | |
}), | |
// 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({ | |
include: [ | |
'node_modules/eventemitter3/**', | |
'node_modules/phaser/**' | |
], | |
exclude: [ | |
'node_modules/phaser/src/polyfills/requestAnimationFrame.js', | |
'node_modules/phaser/src/phaser-esm.js' | |
], | |
sourceMap: false, | |
ignoreGlobal: true | |
}), | |
// See https://github.com/rollup/plugins/tree/master/packages/typescript for config options | |
typescript(), | |
// See https://github.com/rollup/plugins/tree/master/packages/terser for config options | |
terser() | |
] | |
}; |