razzle-plugin-wasm
This package contains a plugin to load wasm files with razzle
Usage in Razzle Projects
yarn add razzle-plugin-wasm --dev
create a razzle.config.js file in root directory of project (next to the package.json) and put this content inside it
Using the plugin with the default options
// razzle.config.js moduleexports = plugins: 'wasm';
Usage
import'./add.wasm'
Usage with emscripten modules, built without SINGLE_FILE
// modulename.mjs renamed from module.js; // important, use .mjs ; // Since webpack will change the name and potentially the path of the // `.wasm` file, we have to provide a `locateFile()` hook to redirect// to the appropriate URL.// More details: https://kripken.github.io/emscripten-site/docs/api_reference/module.htmlconst mod = ; modonRuntimeInitialized = async { console;};
Usage with emscripten modules, built with SINGLE_FILE
// modulename.mjs renamed from module.js; // important, use .mjs modonRuntimeInitialized = async { console;};