Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using wasm with Nuxt3 #19

Closed
cesarecaoduro opened this issue Dec 1, 2022 · 4 comments
Closed

using wasm with Nuxt3 #19

cesarecaoduro opened this issue Dec 1, 2022 · 4 comments

Comments

@cesarecaoduro
Copy link

I am trying to use a wasm with Nuxt3 but it keeps failing...anyone that can help me with configuration?

nuxt.config.ts

import wasm from 'vite-plugin-wasm';

export default defineNuxtConfig({
    vite: {
        plugins: [
            wasm()
        ]
    }
})
@Menci
Copy link
Owner

Menci commented Dec 2, 2022

Any reproduce?

@cesarecaoduro
Copy link
Author

Hi @Menci, here you go...
https://github.com/cesarecaoduro/nuxt-occ

@Menci
Copy link
Owner

Menci commented Dec 7, 2022

Your WASM package is NOT one with esm-integration.

image

The opencascade.full.js is even not an ESM file. It's a handwriteen (or generated) WASM file loader. Following the declaration and guide, you shoud call init() to fetch and initialize the WASM module and it has nothing to do with this plugin. Maybe vite-plugin-top-level-await could help you since you need to await init().

@Menci
Copy link
Owner

Menci commented Dec 7, 2022

Found a sample for you to use it with Vite. Note that you don't need this plugin.

https://github.com/donalffons/opencascade.js/pull/141/files#diff-881623410b5b8961b0a239ca26372de6ac76895634a7331256117145896fa250R52

@Menci Menci closed this as completed Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants