September 2018
Intermediate to advanced
328 pages
9h 10m
English
In the case of this application, building refers to compiling the lib/main.c to a .wasm file using the emcc command. Since this is a Node.js project, we can use the scripts key in our package.json file to define Tasks. You can still use VS Code's Tasks feature because it automatically detects the scripts from your package.json file and presents them in the list of tasks when you select Tasks | Run Task... from the menu. The following code contains the contents of the scripts section in this project's package.json file:
"scripts": { "prebuild": "rimraf src/assets/main.wasm", "build": "emcc lib/main.c -Os -s WASM=1 -s SIDE_MODULE=1 -s BINARYEN_ASYNC_COMPILATION=0 -s ALLOW_MEMORY_GROWTH=1 -o src/assets/main.wasm", "start": ...Read now
Unlock full access