This is a Phaser 3 project template that uses esbuild for bundling. It supports hot-reloading for quick development workflow, includes TypeScript support and scripts to generate production-ready builds.
This Template is also available as a JavaScript version.
This template has been updated for:
Node.js is required to install dependencies and run scripts via npm
.
Command | Description |
---|---|
npm install |
Install project dependencies |
npm run dev |
Launch a development web server |
npm run build |
Create a production build in the dist folder |
After cloning the repo, run npm install
from your project directory. Then, you can start the local development server by running npm run dev
.
The local development server runs on http://localhost:4101
by default.
After you run the npm run build
command, your code will be built into a single bundle and saved to the dist
folder, along with any other assets your project imported, or stored in the public assets folder.
In order to deploy your game, you will need to upload all of the contents of the dist
folder to a public facing web server.
If you want to customize your build, such as adding plugin (i.e. for loading CSS or fonts), you can modify the esbuild/build.prod.mjs
and esbuild/dev.server.mjs
files for cross-project changes, or you can modify and/or create new configuration files and target them in specific npm tasks inside of package.json
. Please see the esbuild documentation for more information.