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

Deno target on windows error. #2296

Closed
juzi5201314 opened this issue Aug 26, 2020 · 0 comments · Fixed by #2297
Closed

Deno target on windows error. #2296

juzi5201314 opened this issue Aug 26, 2020 · 0 comments · Fixed by #2297
Labels

Comments

@juzi5201314
Copy link
Contributor

Describe the Bug

When I use the deno target, there will be an error that {name}_bg.wasm cannot be found

Steps to Reproduce

  1. Run wasm-pack build --target=deno --out-name=deno_test
  2. import { ... } from './pkg/deno_test.js'

Expected Behavior

Actual Behavior

error: Uncaught NotFound: 系统找不到指定的文件。 (os error 2)(The system can not find the file specified)

Additional Context

os: Windows10 19042.450 (20H2)
import.meta.url: file:///C:/Users/soeur/CLionProjects/deno-deno_test/pkg/deno_test.js
const file = new URL(import.meta.url).pathname: /C:/Users/soeur/CLionProjects/deno-deno_test/pkg/deno_test.js

I think...

The reason for this problem is that in my case, os==windows but the separator is / instead of \, and the first character of URL.pathname is /

alexcrichton pushed a commit that referenced this issue Jun 18, 2021
…2297)

* Update mod.rs

* Update mod.rs

* Support http protocol to obtain wasm file remotely

* Another stupid mistake...

* Fix errors caused by `{}`

* `bg` is missing

* RealPathSync cannot be used to get the parent directory of file under linux, so substring and lastIndexOf will be used to get the parent directory under linux

* Missing readFileSync

* Use asynchronous functions instead of synchronous functions.

* Change `includes` to switch-case. And change the synchronous file operation to asynchronous.

* Change to @RReverser suggestion.

* throw a proper Error instance

Co-authored-by: Ingvar Stepanyan <[email protected]>

* Reuse url instance

Co-authored-by: Ingvar Stepanyan <[email protected]>

* Use URL instead of previous backward writing.

* reuse unnecessary code.

Co-authored-by: Ingvar Stepanyan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant