diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2021-07-12 15:08:48 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2021-07-12 15:08:48 +0200 |
| commit | 061208705ceb28dac2c69dd8159452fe439cbdc5 (patch) | |
| tree | 4ad7128aaf7a47ff8da1f3a44efb160ea73ade98 /client/rollup.config.dist.js | |
add(template): phaser3 template project
Diffstat (limited to 'client/rollup.config.dist.js')
| -rw-r--r-- | client/rollup.config.dist.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/client/rollup.config.dist.js b/client/rollup.config.dist.js new file mode 100644 index 0000000..b7e2cb3 --- /dev/null +++ b/client/rollup.config.dist.js @@ -0,0 +1,65 @@ +import commonjs from 'rollup-plugin-commonjs'; +import resolve from 'rollup-plugin-node-resolve'; +import replace from '@rollup/plugin-replace'; +import { uglify } from 'rollup-plugin-uglify'; +import typescript from 'rollup-plugin-typescript2'; + +export default { + + // Our games entry point (edit as required) + input: [ + './src/game.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. + // The 'intro' property can be removed if using Phaser 3.21 or above. Keep it for earlier versions. + output: { + file: './dist/game.js', + name: 'MyGame', + format: 'iife', + sourcemap: false, + intro: 'var global = window;' + }, + + plugins: [ + + // Toggle the booleans here to enable / disable Phaser 3 features: + replace({ + 'typeof CANVAS_RENDERER': JSON.stringify(true), + 'typeof WEBGL_RENDERER': JSON.stringify(true), + '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 + resolve({ + 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' + ], + sourceMap: false, + ignoreGlobal: true + }), + + // See https://www.npmjs.com/package/rollup-plugin-typescript2 for config options + typescript(), + + // See https://www.npmjs.com/package/rollup-plugin-uglify for config options + uglify({ + mangle: false + }) + + ] +};
\ No newline at end of file |
