我正在 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 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
}
}
};