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

Runtime error on WASM #941

Open
Boscop opened this issue Oct 27, 2022 · 3 comments
Open

Runtime error on WASM #941

Boscop opened this issue Oct 27, 2022 · 3 comments

Comments

@Boscop
Copy link

Boscop commented Oct 27, 2022

When I try to use gluon on Wasm (in a web frontend using trunk serve), I get this runtime error:

Uncaught TypeError: Failed to resolve module specifier "env". Relative references must start with either "/", "./", or "../".

I'm using the latest version with these features:

gluon = { git = "https://github.com/gluon-lang/gluon", default-features = false, features = ["random"] }
gluon_codegen = { git = "https://github.com/gluon-lang/gluon" }

(When I don't call the function that uses gluon, the frontend works fine without errors.)

Any idea why it's not working? :)

@Boscop
Copy link
Author

Boscop commented Oct 27, 2022

Btw, a related question:
How can I add gluon modules that should be are available for import, such that I specify them as string (.glu file content + module name), not as real filename?
In my use case the modules only exist as Strings in RAM (e.g. when running in the Wasm frontend), not as files on the file system. So I'd like to import them from RAM, is it possible somehow? :)

@Marwes
Copy link
Member

Marwes commented Oct 28, 2022

Calling load_script will register the script under the given file name which you can then import by refering to the module name (my/file.glu -> my.file etc)

@Marwes
Copy link
Member

Marwes commented Oct 28, 2022

No idea why WASM isn't working, never tested it throughly so something may have broken.

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