Skip to content

wasm-bindgen fails if pkg/ directory (--out-dir) does not exist #1324

Closed
@Vlad-Shcherbina

Description

@Vlad-Shcherbina

To reproduce:

  1. Check out the recent version:
    git clone git@github.com:rustwasm/wasm-bindgen.git
    cd wasm-bindgen
    git checkout eaaf3461
    
  2. Run without-a-bundler example:
    cd .\examples\without-a-bundler\
    cargo build --target wasm32-unknown-unknown --release
    cargo run --manifest-path ../../crates/cli/Cargo.toml --bin wasm-bindgen -- ../../target/wasm32-unknown-unknown/release/without_a_bundler.wasm --out-dir pkg --browser
    

These commands are from build.sh, except I was running them on Windows.

Expected

Stuff to compile, pkg directory with stuff to appear.

Actual result

The last command (cargo run ... wasm-bindgen ...) fails with the following error:

error: failed to write `pkg\without_a_bundler.js`
        caused by: The system cannot find the path specified. (os error 3)
error: process didn't exit successfully: `Z:\wasm-bindgen\target\debug\wasm-bindgen.exe ../../target/wasm32-unknown-unknown/release/without_a_bundler.wasm --out-dir pkg --browser` (exit code: 1)

Manually creating an empty pkg directory fixes this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions