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
Worker.js outputted in wrong location for web_worker_fib demo project #3030
Comments
I ran into this issue when I was investigating why my own project was not outputting any worker.js file at all. EDIT: Whatever my local issue is will be unrelated to this demo bug, but I'm sure I won't be the first person who tries to use this demo to help debug their own projects! |
Does this work when you clone the repo and run it manually? Having run into this before, it may be that however the hosted example is built, it is not built with correct "public url" semantics, allowing it to be hosted at a subpath. EDIT: It works for me locally, so is hopefully public url semantics. |
I think the |
You need to register the worker in the index.html for trunk to compile it. I'm guessing that you missed this step, as I can't think of any other reason why the worker won't be built. The issue you ran into is different from the issue with example. The example fails because the root path is not |
@hamza1311 I'm aware my own issue is unrelated, I should have made that clearer. I was just giving some context to what lead me (and future people in my situation) to check this example. ...I was also fishing for someone to help me out with my own issue which didn't have enough details to ask for help properly! Which you did, and I really appreciate! |
Hello! I registered it using <link data-trunk rel="rust" href="../Cargo.toml" data-bin="app" data-type="main" />
<link data-trunk rel="rust" href="../Cargo.toml" data-bin="worker" data-type="worker" /> I have made the My However I get this error when loading the page:
The rest of the SPA is loading correctly. I am quite new to this, so I don't really have any idea of why this is happening. Hopefully we could improve the Yew-Agent documentation afterwards. EDIT: I just saw the file name is EDIT: Issue was that I didnt implement the fn name_of_resource() -> &'static str of the Worker Trait . Also, just putting fn name_of_resource() -> &'static str {
"worker.js"
} Doesnt work as it isnt taking in account the fn name_of_resource() -> &'static str {
"/app/worker.js"
} |
@vpochapuis you may want https://docs.rs/yew-agent/0.1.0/yew_agent/trait.Agent.html#method.resource_path_is_relative if your worker is not at the root as well - I remember having to do that for a previous project |
@SpanishPear I'm fairly sure that's what's wrong with the demo as well. PR in coming |
Problem
The example project showing how to use web workers does not seem to function, as the
worker.js
file is not outputted in the correct location. It looks like it's being outputted to https://examples.yew.rs/web_worker_fib/worker.js, but the client is trying to load it from https://examples.yew.rs/worker.jsSteps To Reproduce
Steps to reproduce the behavior:
worker.js
has failed to load. (And, by extension ,the demo does not work)(bonus step 4). Go to /web_worker_fib/worker.js and admire the code that was built.
Expected behavior
The file should have been loaded as a webworker and the location it was built to and the location it was attempted to be loaded from should be the same
Screenshots
Environment:
Questionnaire
The text was updated successfully, but these errors were encountered: