phaser-shim
v2.4.8
Published
A shim to make Phaser HTML5 game engine from NPM work with Webpack, and build properly.
Downloads
5
Maintainers
Readme
Phaser Shim
A shim to make Phaser HTML5 game engine from NPM work with Webpack, and build properly.
Installation
npm install phaser-shim --save
Usage
Module
// game.js
require('phaser-shim');
var game = new Phaser.Game(800, 600);
or ES6:
// Game.js
import 'phaser-shim';
class Game extends Phaser.Game {
constructor (width, height) {
super(width, height);
}
}
// game.js
import Game from './Game';
const game = new Game(800, 600);
or several per module:
import {Game, State} from 'phaser-shim';
or TypeScript:
/// <reference path="../node_modules/phaser/typescript/phaser.comments.d.ts" />
declare module 'phaser-shim' {
export = Phaser;
}
Webpack
// webpack.config.js
module: {
// ...
loaders: [{
loader: 'script',// script-loader
test: /(pixi|phaser).js/
}],
// ...
}
Development
If you want to use other Phaser version (old or new) in yourself:
- Fork this repo and git clone to local.
npm install
with node v4.xnpm run build
to buildingdist/pixi
anddist/phaser
- now you can
require
orimport
yourphaser-shim
Contributors
- @AnimaMundi