Created
August 7, 2017 20:50
-
-
Save garbles/6c1aa38f853f2957e9c94b4907100f7e to your computer and use it in GitHub Desktop.
Use Phaser with Typescript + Webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<title></title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script crossorigin src="//cdn.jsdelivr.net/npm/[email protected]/build/phaser.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Phaser = require('phaser'); // works! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="../node_modules/phaser-ce/typescript/phaser.d.ts" /> | |
declare module 'phaser' { | |
export = Phaser; | |
} | |
declare module 'pixi' { | |
export = PIXI; | |
} | |
declare module 'p2' { | |
export = p2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
// ... | |
externals: { | |
phaser: 'Phaser', | |
p2: 'p2', | |
pixi: 'PIXI', | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment