How to set up Box2D-WASM with importmap and Rollup for JavaScript #73
8Observer8
started this conversation in
Show and tell
Replies: 2 comments
-
My simple examples with Box2D-WASM:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I added this step:
|
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
Playground: https://plnkr.co/edit/BGNYcIJRiJXpd9N4?preview
GitHub: https://github.com/8Observer8/how-to-set-up-box2dwasm-with-importmap-rollup-js
glMatrix is just a bonus:
index.html
init-box2d.js
index.js
Instructions for building and running the project in debug and release:
Download and unzip this example: https://github.com/8Observer8/how-to-set-up-box2dwasm-with-importmap-rollup-js
Go to the example folder in the console:
cd how-to-set-up-box2dwasm-with-importmap-rollup-js
Install these packages globally with the command:
Add the Rollup bin folder to the Path. Type this command to know where npm was installed
npm config get prefix
. This command will show you the npm location. You will find the "node_modules" folder there. Go to the "rollup/bin" folder and copy this path, for example for me:C:\Users\8Observer8\AppData\Roaming\npm\node_modules\rollup\dist\bin
. Add this folder to the path variable.Run http-server in the project directory:
Note. The
-c-1
key allows you to disable caching.Note. Rollup will automatically keep track of saving changes to files and build a new index.js file ready for debugging. You can debug your project step by step in the browser by setting breakpoints.
Go to the browser and type the address: localhost:8080/index.html
Create a compressed file ready for publishing. Stop development mode, for example, with this command Ctrl + C in CMD, if it was launched before and enter the command:
Note. After this command, Rollup will create a compressed index.js file. Compression is done using the uglify-js package.
Beta Was this translation helpful? Give feedback.
All reactions