• Stars
    star
    478
  • Rank 88,876 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A quick-start project template that uses Phaser 3, TypeScript and Rollup for bundling

Phaser 3 TypeScript Project Template

This quick-start project template combines Phaser 3.60 with TypeScript 5 and uses Rollup for bundling.

Requirements

Node.js is required to install dependencies and run scripts via npm.

Available Commands

Command Description
npm install Install project dependencies
npm run watch Build project and open web server running project, watching for changes
npm run dev Builds project and open web server, but do not watch for changes
npm run build Builds code bundle with production settings (minification, no source maps, etc..)

Writing Code

After cloning the repo, run npm install from your project directory. Then, you can start the local development server by running npm run watch. The first time you run this you should see the following demo run:

Screenshot

After starting the development server with npm run watch, you can edit any files in the src folder and Rollup will automatically recompile and reload your server (available at http://localhost:10001 by default).

Configuring Rollup

  • Edit the file rollup.config.dev.js to edit the development build.
  • Edit the file rollup.config.dist.js to edit the distribution build.

You will find lots of comments inside the rollup config files to help you do this.

Note that due to the build process involved, it can take around 20 seconds to build the initial bundle. Times will vary based on CPU and local drive speeds. The development config does not minify the code in order to save build time, but it does generate source maps. If you do not require these, disable them in the config to speed it up further.

Versions Used

  • Phaser 3.60
  • TypeScript 5.0.3
  • Rollup 3.20.2
  • Rollup Plugins:
    • @rollup/plugin-commonjs 24.0.1
    • @rollup/plugin-node-resolve 15.0.2
    • @rollup/plugin-replace 5.0.2
    • @rollup/plugin-terser 0.4.0
    • @rollup/plugin-typescript 11.1.0
    • rollup-plugin-serve 2.0.2

More Repositories

1

phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
JavaScript
36,414
star
2

phaser-ce-examples

Contains hundreds of source code examples and related media for the Phaser HTML5 Game Framework.
JavaScript
1,751
star
3

examples

Phaser 3 Examples
JavaScript
1,480
star
4

phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
JavaScript
1,331
star
5

template-webpack

A Phaser 3 project template that uses Webpack 5 for bundling
JavaScript
1,136
star
6

phaser-ce-plugins

For Phaser related Plugins
JavaScript
205
star
7

phaser-ce-coding-tips

Phaser Coding Tips
HTML
145
star
8

custom-build

Create your own custom Phaser 3 builds and shave hundreds of KB off your bundle size.
JavaScript
79
star
9

template-vite-ts

A Phaser 3 project template that uses TypeScript and Vite for bundling
TypeScript
67
star
10

template-vite

A Phaser 3 project template that uses Vite for bundling
JavaScript
63
star
11

facebook-instant-games

Phaser 3 Facebook Instant Games Examples
JavaScript
46
star
12

template-react

A Phaser 3 project template that demonstrates React communication and uses Vite for bundling
JavaScript
46
star
13

dev

The Phaser 4 R&D Repo. This is ground-zero, where we test new features before making official examples from them.
JavaScript
40
star
14

plugin-template

A base plugin template for Phaser 3
JavaScript
39
star
15

template-react-ts

A Phaser 3 TypeScript project template that demonstrates React communication and uses Vite for bundling
TypeScript
34
star
16

template-svelte

A Phaser 3 project template that combine Svelte with TypeScript and uses Vite for bundling
TypeScript
30
star
17

web-monetization-plugin

An easy-to-use Web Monetization Plugin for HTML5 game frameworks, including Phaser and Pixi.
HTML
29
star
18

template-vue

A Phaser 3 project template that demonstrates Vue communication and uses Vite for bundling
JavaScript
29
star
19

template-vue-ts

A Phaser 3 TypeScript project template that demonstrates Vue communication and uses Vite for bundling
Vue
28
star
20

template-nextjs

A Phaser TypeScript project template that uses Next.js
TypeScript
28
star
21

create-game

Easily create a Phaser project with our official template CLI tool
JavaScript
17
star
22

warp-post-fx

Phaser 3 Warp Post FX Pack
TypeScript
16
star
23

template-parcel

A Phaser 3 project template that uses Parcel 2 for bundling
JavaScript
16
star
24

template-angular

A Phaser 3 TypeScript project template that uses the Angular framework and Vite for bundling
TypeScript
14
star
25

template-webpack-ts

A Phaser 3 project template that uses TypeScript and Webpack for bundling
TypeScript
13
star
26

beam-archive

Phaser Beam
JavaScript
11
star
27

template-esbuild

A Phaser 3 project template that uses ESBuild for bundling
JavaScript
10
star
28

template-solid

A Phaser 3 project template that combines SolidJS, TypeScript and uses Vite for bundling
TypeScript
9
star
29

phaser-by-example

The source code to the games that go with the Phaser by Example book
JavaScript
8
star
30

discord-template

A quickstart Phaser template for creating playable Discord Activities
JavaScript
6
star
31

template-rollup

A Phaser 3 project template that uses Rollup for bundling
JavaScript
6
star
32

template-esbuild-ts

A Phaser 3 project template that uses TypeScript and ESBuild for bundling
TypeScript
5
star
33

template-parcel-ts

A Phaser 3 project template that uses TypeScript and Parcel for bundling
TypeScript
5
star
34

template-importmap

A Phaser 3 project template that uses Import Maps instead of a bundler
JavaScript
4
star
35

phaser-ce-wip-archive

Archived Phaser wip files
TypeScript
4
star
36

template-rollup-ts

A Phaser 3 project template that uses TypeScript and Rollup for bundling
TypeScript
4
star
37

vscode-examples-plugin

TypeScript
3
star
38

wip-archive

A home for our temporary and wip dev files
JavaScript
2
star
39

tests

Phaser 4 Unit Tests
HTML
1
star
40

.github

1
star