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

doesn't work on mac #7

Closed
haiaty opened this issue May 2, 2020 · 9 comments
Closed

doesn't work on mac #7

haiaty opened this issue May 2, 2020 · 9 comments

Comments

@haiaty
Copy link

haiaty commented May 2, 2020

Hi,
I'm using a mac and I have tried to use the package but after I cloned it, I ran

npm start

and I got the following error:

/Users/haiaty/Code/rust_projects/my-app/node_modules/parcel-plugin-wasm.rs/wasm-loader.js:2:14: Cannot resolve dependency './yew_app_bg.js' at '/Users/haiaty/Code/rust_projects/my-app/node_modules/parcel-plugin-wasm.rs/yew_app_bg.js'
1 | var wasm;const __exports = {};

2 | export * from "./yew_app_bg.js";
| ^
3 |
4 | function init(wasm_path) {
5 | const fetchPromise = fetch(wasm_path);

What could be the issue?

@jetli
Copy link
Owner

jetli commented May 3, 2020

did you run npx create-yew-app my-app to create a new app, or just clone this repo and run npm start ?
if you clone this repo, you should run npm install first and then run npm start, please see https://github.com/jetli/create-yew-app/tree/master/crates/yew-app#readme

@Voronar
Copy link

Voronar commented May 7, 2020

Maybe blocked by wasm-tool/parcel-plugin-wasm.rs#30

@Voronar
Copy link

Voronar commented May 7, 2020

Temporary webpack alternative: https://github.com/yewstack/yew-wasm-pack-template

@jetli
Copy link
Owner

jetli commented May 8, 2020

Previously I found webpack is very slow for Rust/Wasm when hot reloading, it's unbearable slow for a just medium size project like https://github.com/jetli/rust-yew-realworld-example-app, so finally I've chosen parcel for bundling.

@haiaty
Copy link
Author

haiaty commented May 9, 2020

did you run npx create-yew-app my-app to create a new app, or just clone this repo and run npm start ?
if you clone this repo, you should run npm install first and then run npm start, please see https://github.com/jetli/create-yew-app/tree/master/crates/yew-app#readme

I have installed it and ran 'npm start' . Then I tried to 'npm install' but it doesn't work

@swstegall
Copy link

I tried doing the same thing on Windows 10 and have been having the same sort of trouble. Windows doesn't like using environment variables in-line like you're using them, so I had to add another script to crates\yew-app\package.json called set-dev that uses windows set command, then another script, start-win that chains this into the start command.

Alas, after doing these things, I encountered the same error that @haiaty experienced. This can be fixed with the temporary fix mentioned in the link posted by @Voronar, wasm-tool/parcel-plugin-wasm.rs#30. To fix this issue with the current codebase if you're working with the project locally, do the following:

  1. Open crates\yew-app\Cargo.toml.
  2. Edit wasm-bindgen to wasm-bindgen = "0.2, <0.2.61".

You should now be able to do npm start and have the project work.

@jetli
Copy link
Owner

jetli commented May 11, 2020

temp fix by wasm-bindgen = "0.2, <0.2.61"

@jetli
Copy link
Owner

jetli commented Jun 28, 2020

Fixed by #11

@jetli jetli closed this as completed Jun 28, 2020
@patientplatypus6
Copy link

This isn't fixed - have same error.

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

No branches or pull requests

5 participants