Skip to content

Latest commit

 

History

History

integration-test

Integration test

If you're developing changes to box2d-wasm in this monorepo, you can use this integration-test package to validate your changes.

It's a Svelte web application, bundled with Rollup.

This package demonstrates a realistic integration of box2d-wasm into a modern web application (npm, TypeScript, ES imports, bundler, UI framework).

Setup

Follow the steps detailed in Developing in this monorepo.

This should ensure that the following files exist:

node_modules/box2d-wasm/build/es/Box2D.js
node_modules/box2d-wasm/build/es/Box2D.wasm
node_modules/box2d-wasm/build/Box2D.d.ts

Run

Serve the Svelte application:

npm start

Navigate to localhost:4000.

Bundle for production

Build a production bundle into public/build:

# clean any build artifacts left from npm start
rm -rf public/build
npm run build

Verify the production bundle

Serve the public folder:

npm run serve

Navigate to localhost:5000.

You probably have your own solution for serving in production. Refer to the Emscripten docs for advice on how to serve .wasm files with the correct MIME type (application/wasm).

Changing the application

If you're using Visual Studio Code: consider the official extension Svelte for VS Code.