错误:wasm 的异步和同步获取均失败

问题描述 投票:0回答:2

我正在 IONIC4 中开发混合应用程序。使用 typeorm 作为数据库。出现错误

core.js:9110 ERROR Error: Uncaught (in promise): abort("abort(\"both async and sync fetching of the wasm failed\"). Build with -s ASSERTIONS=1 for more info."). Build with -s ASSERTIONS=1 for more info.
at resolvePromise (zone-evergreen.js:797)
at zone-evergreen.js:862
at ZoneDelegate.invokeTask (zone-evergreen.js:391)
at Object.onInvokeTask (core.js:34182)
at ZoneDelegate.invokeTask (zone-evergreen.js:390)
at Zone.runTask (zone-evergreen.js:168)
at drainMicroTaskQueue (zone-evergreen.js:559)
angular ionic4 hybrid-mobile-app typeorm sql.js
2个回答
4
投票

将编译后的文件(starfield.html、starfield.js、starfield.wasm)放入 Web 服务器并使用 http 运行。 enter image description here


0
投票

Angular 12 和 ionic 5 上也有同样的问题,我认为这可能是由 webpack 和 sql.js 引起的。这是我的 custom.webpack.config.js:

const webpack = require('webpack');
console.log('The custom config is used');
module.exports = {
    plugins: [
        new webpack.ProvidePlugin({
            'window.SQL': 'sql.js/dist/sql-wasm.js'
        }),
        new webpack.NormalModuleReplacementPlugin(/typeorm$/, function (result) {
            result.request = result.request.replace(/typeorm/, "typeorm/browser");
        })
    ],
   
    resolve: {
        fallback: {
          fs: false,
          net: false,
          tls: false
        }
      }
};
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.