如何在 vue 应用程序中导入“wasm”文件?

Yas*_*aur 5 vue.js webassembly

我想在 vue 组件中导入我的 wasm 文件。我尝试过不同的方法,但我感到困惑。这就是我所尝试过的全部 -

  • 我已经使用选项修改了“vue.config.js”文件 -chainWebpack以包含我的 wasm 文件。

  • 然后我尝试导入 wasm 但它抛出了这个错误 -This is not allowed, because WebAssembly download and compilation must happen asynchronous.Add an async splitpoint (i. e. import()) somewhere between your entrypoint and the WebAssembly module:

这是我的 vue.js.config 文件: `module.exports = {

publicPath: '/',
chainWebpack: webpackConfig => {
    webpackConfig.module
        .rule('wasm')
        .test(/.wasm$/)
        .use('wasm-loader')
        .loader('wasm-loader')
}
Run Code Online (Sandbox Code Playgroud)

}'

我从这里编译了我的 C++ 代码 -https://mbebenita.github.io/WasmExplorer/

谁能帮我?我在这里做错了什么?