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

Non-NPM operation of wasm-pack #811

Closed
aidanhs opened this issue Mar 8, 2020 · 1 comment · Fixed by #1291
Closed

Non-NPM operation of wasm-pack #811

aidanhs opened this issue Mar 8, 2020 · 1 comment · Fixed by #1291

Comments

@aidanhs
Copy link

aidanhs commented Mar 8, 2020

💡 Feature description

I'd like to take a pkg directory and ship it around/use it directly as a static directory. However, it currently includes a package.json, .gitignore and a bunch of .d.ts files - it seems that the expectation is that I'm using NPM somewhere in my toolchain?

I'd like a way to say "just give me the static, assume nothing about my toolchain" - I don't want to distribute the directory and discover down the line that unexpected stuff has been bundled in (for example, the package.json currently contains my e-mail address).

(it may also be sufficient to just concretely specify+commit to what the directory will contain, as I can then add tooling to manipulate it without being surprised down the line by new stuff appearing)

Relates to:

@antonok-edm
Copy link

Anyone else following this issue might be interested in using wasm-bindgen-cli directly instead of wasm-pack which wraps around it. After some investigation, I've discovered that the build process is quite simple; most of the benefit that wasm-pack provides is specifically designed for NPM integration.

In short, if you run the following:

cargo build --lib --release --target wasm32-unknown-unknown
wasm-bindgen --target web --no-typescript --out-dir static target/wasm32-unknown-unknown/release/<your_crate_name>.wasm

...you'll get just the static <your_crate_name>_bg.wasm WASM file and <your_crate_name>.js JS wrapper created in the ./static directory. The output of wasm-bindgen --help is also quite useful for exploring other potentially useful flag options.

I'm not sure why wasm-bindgen-cli gets so much less attention compared to wasm-pack, but it would be neat to have better documentation comparing the two and describing their respective use-cases.

@ranile ranile mentioned this issue May 30, 2023
3 tasks
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.

2 participants