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

Support for Deno #110

Open
binyamin opened this issue Jul 3, 2022 · 4 comments · May be fixed by #111
Open

Support for Deno #110

binyamin opened this issue Jul 3, 2022 · 4 comments · May be fixed by #111

Comments

@binyamin
Copy link

binyamin commented Jul 3, 2022

Note: Coming from parcel-bundler/lightningcss#219

I haven't been able to get this module working for Deno

  • The source uses typescript syntax (import type) with a .js extension. Deno can't read it properly
  • The NPM package uses CommonJS (require), but Deno uses ESM (import)
  • CDNs
    • unpkg.com pulls from NPM, so we get the same issue.
    • esm.sh & skypack.dev both transform the CommonJS to ESM. Unfortunately, they don't serve WASM files with the right content-type, so Deno can't process it normally. The way Deno does process it, it throws an error during compilation. Something about a mismatched "magic word".
@binyamin binyamin changed the title Support fpr Deno Support for Deno Jul 3, 2022
@mischnic
Copy link
Member

mischnic commented Jul 4, 2022

This would be nice, and fixing this would also enable importing it directly in browsers via the CDNs.

We'd just need a pure ESM version of https://unpkg.com/browse/@parcel/source-map@2.0.5/dist/wasm.js and its dependencies. And it would have to use wasm-bindings-web.js

The source uses typescript syntax (import type) with a .js extension

That's actually Flow syntax.

@DeMoorJasper
Copy link
Member

Not sure if we should ship an extra large bundle to support this, I think you can already load it using esm.sh, something like: https://esm.sh/@parcel/source-map@2.0.5/dist/wasm.js

@mischnic
Copy link
Member

mischnic commented Jul 4, 2022

As already mentioned, that doesn't work for other reasons:

Bildschirmfoto 2022-07-04 um 10 19 23

Bildschirmfoto 2022-07-04 um 10 19 54

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Jul 4, 2022

That's not up to us to fix that right? Seems like an esm.sh issue?

But I guess it's not a big deal for us to also ship esm as the js size is so small anyway. Which should be easy to fix. Might look into it tonight

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

Successfully merging a pull request may close this issue.

3 participants