【问题标题】:Rust Wasm - The Game Of Life tutorial has failed to compile a webpack-dev-server [closed]Rust Wasm - The Game Of Life 教程未能编译 webpack-dev-server [关闭]
【发布时间】:2021-09-29 20:23:11
【问题描述】:
System description:
macOS Big Sur ver. 11.4
MacBook Pro
Processor: 2.4
Mem: 8GB
Graphics: Intel Iris 1536 MB

Webpack-dev-server compiler 2 安装过程中的问题。

第一期。

npm 运行开始

> create-wasm-app@0.1.0 start /Users/name/RUSTWASM/TUTORIAL/gameoflife/www
> webpack-dev-server

/Users/name/RUSTWASM/TUTORIAL/gameoflife/www/node_modules/schema- 
utils/dist/validate.js:105
throw new _ValidationError.default(errors, schema, configuration);
^

ValidationError: Invalid options object. Copy Plugin has been initialized using 
an options object that does not match the API schema.

**第二期

The module seem to be a WebAssembly module, but module is not flagged as WebAssembly 
module for webpack.

【问题讨论】:

    标签: rust webassembly


    【解决方案1】:

    第一期

    我在这里找到了解决该问题的方法。 npm run dev fails : ValidationError: Invalid options object

    这是一个 webpack 配置语法错误:

    旧语法:

    new CopyWebpackPlugin(
      [
        { from: '', to: '' },
        { from: '', to: '' }
      ]
    )
    

    新语法:

    new CopyWebpackPlugin(
      { 
        patterns: [
          { from: '', to: '' },
          { from: '', to: '' }
        ]
      }
    )
    

    第二期

    第二个问题的解决方案在这个文件里面:webpack.config.js 根据Can not use web-assembly rust impl because of 'Cannot access '__wbindgen_throw' before initialization' error

    experiments: {
        syncWebAssembly: true // !! <- use syncWebAssembly instead of asyncWebAssembly
    },
    

    完整的工作代码在这里。 https://github.com/cichy/gameoflife

    【讨论】:

    • 如果您还没有,请考虑在 repo 的问题跟踪器上发帖。希望这些问题能够得到解决。或者更好的是,考虑做一个 PR。
    • 会的。感谢您的帮助。
    猜你喜欢
    • 2021-01-28
    • 2022-12-26
    • 1970-01-01
    • 2020-12-19
    • 2020-12-02
    • 1970-01-01
    • 1970-01-01
    • 2017-06-06
    • 1970-01-01
    相关资源
    最近更新 更多