There are lots of options for building a PlayCanvas app. One is to use Webpack, a popular JavaScript bundler.
This project doesn't load the PlayCanvas engine via a script tag. Instead, it imports the engine as an NPM package (see the repo's package.json
file). The src/index.js
script then imports the PlayCanvas (pc
) API with the following statement:
import * as pc from 'playcanvas';
Run:
npm install
npm run build
This will output the built PlayCanvas app to the dist
folder.
Run:
npm run dev
Open http://localhost:5000/
in your browser of choice. You should see a spinning cube: