Skip to content

Commit 0684bad

Browse files
committed
1.7.0 Update entry order and dependencies
1 parent 803620b commit 0684bad

8 files changed

Lines changed: 30 additions & 31 deletions

File tree

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
- Minification for build output
1717
- Source mapping (TypeScript breakpoints works with VS Code [Chrome Debugging Extension](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome)).
1818
- Supports modern ECMA syntax as well as typings/intelliSense from [TypeScript](http://www.typescriptlang.org/).
19-
- Browser compatibility down to Internet Explorer 9 with [Babel](https://babeljs.io/) transformations and polyfills.
19+
- Browser compatibility down to Internet Explorer 9 with [Babel](https://babeljs.io/) transformations and [core-js](https://github.com/zloirock/core-js) polyfills.
2020
- The build output is playable offline.
2121

2222
## Installation
@@ -38,8 +38,6 @@ Open this folder in Visual Studio code and from menu:
3838

3939
`npm run build` To build (minified and playable offline, creates `build` folder)
4040

41-
`npm run deploy` To deploy (build with no source map, creates `.deploy` folder)
42-
4341
## Important Note
4442
Due to bundling and limitation of mounting Phaser to window scope, do not import Phaser as destructured ES modules (becareful as this is suggested by auto import), for example:
4543
``` ts

build/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Phaser CE ParcelJS</title><style>body,html{margin:0;padding:0}#content{position:fixed;height:100%;width:100%}#content canvas{box-shadow:0 0 5px #000}</style><script src="src.f41f1486.js"></script></head><body> <div id="content"></div> </body></html>
1+
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Phaser CE ParcelJS</title><style>body,html{margin:0;padding:0}#content{position:fixed;height:100%;width:100%}#content canvas{box-shadow:0 0 5px #000}</style><script defer src="src.aedbd861.js"></script></head><body> <div id="content"></div> </body></html>
Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/src.aedbd861.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/src.f41f1486.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
22
"name": "phaser-ce-parceljs",
3-
"version": "1.6.0",
3+
"version": "1.7.0",
44
"description": "Phaser CE boilerplate with typescript, babel and parcel bundler.",
55
"scripts": {
66
"start": "parcel serve src/index.html --out-dir dev/",
7-
"build": "parcel build src/index.html --out-dir build/ --public-url ./",
8-
"deploy": "parcel build src/index.html --out-dir .deploy/ --public-url ./ --no-source-maps"
7+
"build": "parcel build src/index.html --out-dir build/ --public-url ./"
98
},
109
"keywords": [
1110
"phaser",
@@ -22,16 +21,16 @@
2221
},
2322
"license": "MIT",
2423
"devDependencies": {
25-
"@babel/core": "^7.6.4",
26-
"@babel/plugin-transform-runtime": "^7.6.2",
27-
"@babel/preset-env": "^7.6.3",
24+
"@babel/core": "^7.8.3",
25+
"@babel/plugin-transform-runtime": "^7.8.3",
26+
"@babel/preset-env": "^7.8.3",
2827
"@types/parcel-env": "^0.0.0",
2928
"parcel": "^1.12.4",
30-
"typescript": "^3.6.4"
29+
"typescript": "^3.7.5"
3130
},
3231
"dependencies": {
33-
"@babel/runtime": "^7.6.3",
34-
"core-js": "^3.3.3",
35-
"phaser-ce": "^2.13.3"
32+
"@babel/runtime": "^7.8.3",
33+
"core-js": "^3.6.4",
34+
"phaser-ce": "^2.14.0"
3635
}
3736
}

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
box-shadow: 0px 0px 5px black;
2323
}
2424
</style>
25-
<script src="./index.ts"></script>
25+
<script defer src="./index.ts"></script>
2626
</head>
2727

2828
<body>

src/index.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
import './global'
22
import { Boot, Preloader, GamePlay } from '/states'
33

4+
// Hot module replacement init
45
if (module.hot)
56
{
67
module.hot.dispose(destroyGame)
78
module.hot.accept(() => console.log("[HMR]", "Accept"))
89
}
910

11+
// Entry point
1012
!(async () =>
1113
{
12-
if (!window.GameInstance)
14+
if (!window.GameInstance) //
1315
{
16+
// Walkaround to prevent canvas from appearing as black from top left corner when starting the game.
17+
const container = document.querySelector<HTMLDivElement>("#content")
18+
container.style.setProperty("visibility", "hidden")
19+
1420
const game = window.GameInstance = await startGameAsync()
1521

22+
game.state.add(Preloader.key, Preloader)
1623
game.state.add(GamePlay.key, GamePlay)
1724

25+
Boot.onCreate.addOnce(() =>
26+
{
27+
game.state.start(Preloader.key);
28+
container.style.removeProperty("visibility")
29+
})
30+
1831
Preloader.onCreate.addOnce(() =>
1932
{
2033
game.state.start(GamePlay.key);
@@ -46,25 +59,14 @@ async function startGameAsync()
4659
state: Boot
4760
}
4861

49-
// Walkaround to prevent canvas from appearing as black from top left corner when starting the game.
50-
const container = document.querySelector<HTMLDivElement>("#content")
51-
container.style.setProperty("visibility", "hidden")
52-
5362
const game = new Phaser.Game(config)
5463

55-
game.state.add(Preloader.key, Preloader)
56-
57-
Boot.onCreate.addOnce(() =>
58-
{
59-
game.state.start(Preloader.key);
60-
container.style.removeProperty("visibility")
61-
})
62-
6364
resolve(game)
6465
})
6566
})
6667
}
6768

69+
// Hot module replacement disposal
6870
function destroyGame()
6971
{
7072
console.log("[HMR]", "Destroy Game")

0 commit comments

Comments
 (0)