A template boilerplate for making phaser 3 projects (could be other projects) and build them for android and ios (or browser) using Webpack and Cordova.
Installation steps to set this template up and running.
git clone https://github.com/PeeJeeDR/phaser-3-webpack-cordova.git PROJECT_NAME
cd PROJECT_NAME
rm -rf .git
git init
yarn
yarn serve
On desktop visit http://localhost:8080 to open the project. In order to visit the project on another device (phone, ipad, etc.) you wil have to get the public ip address of your machine first. You can do this by running the following command (in new terminal):
MAC
yarn get-ip
Execute ifconfig
if this doesn't work and find it there.
WINDOWS
ipconfig
Find your IPv4 address.
Now you can visit this ip address in the browser on your external device followed by the :PORT
. (ex. http://192.168.1.5:8080)
Make sure your devices are on the same network.
This will put the builded files in the www
folder (used by Cordova)
yarn build
First update the config.xml to your preferences. (name, description, ...)
In this example I will use android as example. Change android
to ios
for iOS build.
Make sure you ran yarn build
at least once so that the www
folder is present.
cordova platform add android
cordova run android
This command will run an emalator on your machine if you have installed Android studio (Android) or XCode (iOS). If your device is connected to your machine with a cable it should open there.
NOTE: There is no live/hot reload with the cordova run
command. Use yarn serve
instead to test on your device.
cordova build android
cordova build --release android