Skip to content

ammar-oker/phaser-parcel

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phaser 3 with Parcel

Parcel is a fast, zero-config web application bundler.

This is a simple Phaser game template using Parcel, and based on Making your first Phaser 3 game.

Most common transformations (CoffeeScript, Babel/Flow, TypeScript) work “out of the box”.

Use

# If you don't have Parcel, install it:
npm install -g parcel-bundler

# Auto-compile and run dev server:
npm run start

# Compile for production:
npm run build

You can edit these scripts in package.json to suit your needs.

See:

Game assets

Static assets used in your JavaScript need to be imported or required:

require('../assets/sky.png') // -> './sky.8fef0675.png'

See bootScene for an example.

If you prefer, you can use a plugin to copy static assets instead.

Package aliasing

You can use package.alias to specify an alternative Phaser build, e.g.,

{
  "name": "my-phaser-game",
  "alias": {
    "phaser": "./node_modules/phaser/src/phaser-arcade-physics.js"
  }
}

Hot reload

When running the dev server the game is destroyed and then recreated after you save changes to your files. Rarely, this can fail. Just refresh the browser.

If you don't like hot reload at all, you can turn it off:

parcel serve src/index.html --no-hmr

About

A Phaser 3 game template using Parcel bundler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.4%
  • HTML 2.6%