No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    support for webassembly with wasm-bindgen?

    Framework
    2
    2
    165
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Samzelot last edited by Samzelot

      I’ve tried for a while now to import a wasm-bindgen project generated with wasm-pack from rust code into a quasar project. I’ve managed to do so successfully from another pure vue/webpack project, but for some reason It’s not working in quasar. I’m new to both webassembly and quasar, so I might be missing something obvious…

      The code is currently in a boot file:

      import('open-optics-module-model').then(oom => {
        console.log("working!");
      });
      

      package.json for project:

      {
        "name": "open-optics-module",
        "version": "0.0.1",
        "description": "Tool for experimenting with geometrical optics.",
        "productName": "Open Optics Module",
        "author": "Samuel Selleck <sellecksamuel@gmail.com>",
        "private": true,
        "scripts": {
          "test": "echo \"No test specified\" && exit 0"
        },
        "dependencies": {
          "@quasar/extras": "^1.0.0",
          "core-js": "^3.6.5",
          "open-optics-module-model": "file:../pkg",
          "pixi.js": "^5.3.3",
          "quasar": "^1.0.0"
        },
        "devDependencies": {
          "@quasar/app": "^2.0.0"
        },
        "browserslist": [
          "last 10 Chrome versions",
          "last 10 Firefox versions",
          "last 4 Edge versions",
          "last 7 Safari versions",
          "last 8 Android versions",
          "last 8 ChromeAndroid versions",
          "last 8 FirefoxAndroid versions",
          "last 10 iOS versions",
          "last 5 Opera versions"
        ],
        "engines": {
          "node": ">= 10.18.1",
          "npm": ">= 6.13.4",
          "yarn": ">= 1.21.1"
        }
      }
      

      package.json for generated wasm-pack project (followed rust tutorial):

      {
        "name": "open-optics-module",
        "collaborators": [
          "Samuel Selleck <sellecksamuel@gmail.com>"
        ],
        "version": "0.1.0",
        "files": [
          "open_optics_module_bg.wasm",
          "open_optics_module.js",
          "open_optics_module.d.ts"
        ],
        "module": "open_optics_module.js",
        "types": "open_optics_module.d.ts",
        "sideEffects": false
      }
      

      The log:

      Uncaught (in promise) TypeError: wasmExports is undefined
          wasm vendor.js:2108
          __webpack_require__ app.js:854
          fn app.js:151
          <anonymous> open_optics_module_bg.js:1
          <anonymous> open_optics_module_bg.js:73
          js vendor.js:2086
          __webpack_require__ app.js:854
          fn app.js:151
          <anonymous> open_optics_module.js:1
          js vendor.js:2074
          __webpack_require__ app.js:854
          fn app.js:151
          promise callback*__webpack_exports__.default/< open-optics-module-model.js:6
          default open-optics-module-model.js:5
          start client-entry.js:84
          async* client-entry.js:129
          js app.js:1022
          __webpack_require__ app.js:854
          fn app.js:151
          0 app.js:1176
          __webpack_require__ app.js:854
          checkDeferredModules app.js:46
          <anonymous> app.js:997
          <anonymous> app.js:1000
      

      haven’t changed quasar.config.js (other than adding the boot file).

      The problem dissapears if I don’t include the .wasm file, but that defeats the purpose…

      Thanks in advance!

      /Samuel

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @Samzelot last edited by

        @Samzelot

        Hard to say without code. It would probably help if you post a repo of your successful pure vue/webpack project. And a repo of your failed quasar project would probably also help.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post