小编Jos*_*ore的帖子

如何满足 wasm 的严格 mime 类型检查?

我得到了一个使用 emscripten 编译的 webassembly 模块。现在我正在尝试使用 expressjs 在网页中提供它。

我已经尝试按照这个要点来通过 webpack 包含 webassembly,包括我发现的一个修改,因为这个要点有点旧。

webpack 看起来像这样:

const path = require('path');

module.exports = {
  optimization: {
    mangleWasmImports: false
  },
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, './dist/'),
    filename: 'dynamic-graph.bundle.js'
  },
  target: "web",
  module: {
    rules: [
      // Emscripten JS files define a global. With `exports-loader` we can 
      // load these files correctly (provided the global’s name is the same
      // as the file name).
      {
        test: /fourd\.js$/,
        loader: "exports-loader"
      },
      // wasm files …
Run Code Online (Sandbox Code Playgroud)

browser webpack server webassembly

9
推荐指数
1
解决办法
1124
查看次数

标签 统计

browser ×1

server ×1

webassembly ×1

webpack ×1