wasm-pack icon indicating copy to clipboard operation
wasm-pack copied to clipboard

Support deno target

Open juzi5201314 opened this issue 4 years ago • 10 comments

  • [x ] You have the latest version of rustfmt installed

  • [x ] You ran cargo fmt on the code base before submitting

  • Related issues #672 #879

juzi5201314 avatar Aug 27 '20 05:08 juzi5201314

Is there any update on this? It is mentioned in the docs already here.

OliverBrotchie avatar Aug 30 '20 03:08 OliverBrotchie

As https://github.com/rustwasm/wasm-pack/issues/879#issuecomment-662835589 said, wasm-bingen seems to have recently gained support for deno target, but the option is not forwarded to it by wasm-pack.

juzi5201314 avatar Aug 30 '20 03:08 juzi5201314

Hey everyone,

This seems like a relatively small change, but would help greatly in writing wasm modules for Deno, is there anything blocking this? Is there anything to do to get it merged?

Sh4rK avatar Oct 13 '20 22:10 Sh4rK

This looks helpful, is it missing anything?

olanod avatar Oct 22 '20 14:10 olanod

I am using this branch, couple of problems I had

  1. wasm-pack build --help didn't list deno as a target option
  2. the .js generated in pkg doesn't manipulate the file path correctly for me (may be related to the fact that I use git bash as my main console)
    1. I use windows, yet the path string still comes with / and not \, so Deno.build.os === 'windows' ? '\\' : '/' give a wrong result
    2. new URL(import.meta.url).pathname gives a path with \ before C: for some reason?

except for this, it works perfectly! took me some time to realize that I needed the .js suffix in the import in my deno code, but it did work!

edit: after thinking about it a bit, the problems in 2 are probably problems in wasm-bingen and not this pr sorry if that's the case

Mipsters avatar Nov 21 '20 23:11 Mipsters

After another year ... it's not supported yet, the deno target

mindon avatar Sep 02 '21 01:09 mindon

I'd very much like to see this merged. Is anything holding us back? I'd be happy to provide the necessary adjustments if required.

egfx-notifications avatar Feb 08 '22 16:02 egfx-notifications

I am using this branch, couple of problems I had

1. `wasm-pack build --help` didn't list `deno` as a target option

2. the `.js` generated in pkg doesn't manipulate the file path correctly for me
   (may be related to the fact that I use git bash as my main console)
   
   1. I use windows, yet the path string still comes with `/` and not `\`, so `Deno.build.os === 'windows' ? '\\' : '/'` give a wrong result
   2. `new URL(import.meta.url).pathname` gives a path with `\` before `C:` for some reason?

except for this, it works perfectly! took me some time to realize that I needed the .js suffix in the import in my deno code, but it did work!

edit: after thinking about it a bit, the problems in 2 are probably problems in wasm-bingen and not this pr sorry if that's the case

@Mipsters Your point 2.2 seems to be fixed in the current wasm-bindgen release, the path is concatenated differently now.
2.1 I don't get right now, is Deno.build.os === 'windows' ? '\\' : '/' something you use in your code or something that wasm-bindgen created? Either way, I can't see this in output of current wasm-bindgen.
Your first point would definitely be an improvement to this PR.

egfx-notifications avatar Feb 08 '22 16:02 egfx-notifications

@egfx-notifications wow, I barely remember what I did then, but I think that the ternary condition was not mine
if I remember correctly, it was of some inner library, don't remember if it was part of the pr or something else you can run a simple script to check if this is resolved, if Deno.build.os === 'windows' is true on windows then there is no issue if you don't have a windows machine available, hit me up, but it'll take time for me to remind myself how to use any of this things...

Mipsters avatar Feb 09 '22 07:02 Mipsters

@egfx-notifications wow, I barely remember what I did then, but I think that the ternary condition was not mine if I remember correctly, it was of some inner library, don't remember if it was part of the pr or something else you can run a simple script to check if this is resolved, if Deno.build.os === 'windows' is true on windows then there is no issue if you don't have a windows machine available, hit me up, but it'll take time for me to remind myself how to use any of this things...

Then this seems to be fixed now. Tried cmd, Powershell and Git Bash on Windows, all give the correct result.

egfx-notifications avatar Feb 09 '22 08:02 egfx-notifications

Fixed in #1117.

drager avatar Jul 05 '23 05:07 drager