https://github.com/phaserjs/phaser/blob/master/changelog/3.60/ESMSupport.md
Last active
February 6, 2024 19:27
-
-
Save samme/88a13b20b997a9b3fa75db750b4e555f to your computer and use it in GitHub Desktop.
Phaser 3 with ES modules
This file contains hidden or 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
export const gameConfig = { | |
scene: { | |
create: function () { | |
this.add.text(0, 0, "Hello world"); | |
} | |
} | |
}; |
This file contains hidden or 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"> | |
<link rel=modulepreload href="https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser.esm.js"> | |
<title>Phaser 3 with ES modules</title> | |
<style>html, body { height: 100%; margin: 0; }</style> | |
<script src="main.js" type=module></script> | |
</head> | |
<body></body> | |
</html> |
This file contains hidden or 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 { Game } from "https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser.esm.js"; | |
import { gameConfig } from "./gameConfig.js"; | |
new Game(gameConfig); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment