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

ESM loading fails in the browser #26

Open
KeithHenry opened this issue Aug 11, 2024 · 0 comments
Open

ESM loading fails in the browser #26

KeithHenry opened this issue Aug 11, 2024 · 0 comments

Comments

@KeithHenry
Copy link

KeithHenry commented Aug 11, 2024

Loading the module fails in the browser:
console log showing error

This fails because it attempts to fetch("markdown.wasm") which (because it's ESM loaded) gets resolved on the root path, not the path relative to the module.

So import * as markdown from "../{library}/markdown-wasm/dist/markdown.es.js"; should fetch("../{library}/markdown-wasm/dist/markdown.wasm")

It should use import.meta.url to resolve to the same path.

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

1 participant