Version: 1.6.0
I started using this plugin and can't call WASM anymore.
webpack config:
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
// ...
config.plugins = [
...config.plugins,
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, "../wasm-build"),
outDir: path.resolve(__dirname, "src/pkg"),
}),
];
The browser shows "ERROR Rust compilation" and the console shows this:
(0 , _pkg__WEBPACK_IMPORTED_MODULE_0__.my_wasm_function) is not a function
In the previous working implementation I was using wasm like this:
package.json dependency:
"wasm": "file:../wasm-build",
And then in the JS files:
const wasmPromise = import("wasm");
const { my_wasm_function } = await wasmPromise;
The reason I want to use this plugin is to be able to import like this:
import {
my_wasm_function
} from "../pkg";
Version:
1.6.0I started using this plugin and can't call WASM anymore.
webpack config:
The browser shows "ERROR Rust compilation" and the console shows this:
In the previous working implementation I was using wasm like this:
package.json dependency:
And then in the JS files:
The reason I want to use this plugin is to be able to import like this: