Closed nikhilnxvverma1 closed 3 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
not fixed
@nikhilnxvverma1 : Can you please elaborate with some pictures.... Feels like it will help a lot of people
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@Rajdeep97 you probably wont run into this problem until you are using web workers. Are you using web workers and if so did the above fix not work for you?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Not fixed
For the last 3 days I have been pulling my hair to get a basic angular web worker to work.
ng generate web-worker my-web-worker
When I do that, angular does its job of generating and updating some configuration files. Upon setting up all the other scaffolding code to basically fire up the web worker, my entire console is filled up with errors like:
Cannot find name HTMLSpanElement Cannot find name HTMLCanvas etc, etc...
Now I am not using any DOM API in my ("hello worldish") web worker obviously but all my html component code automatically gets bundled in with the web worker code suggestively spitting the above errors.
After many failed attempts I noticed that the root
tsconfig.json
file (from whichtsconfig.worker.json
inherits), actually hosts all the files from the start"files": [ "src/main.ts", "src/polyfills.ts" ], "include": [ "src/**/*.d.ts" ], "exclude":[ "node_modules ]
A general angular project, usually has these critical file handling configurations listed under
tsconfig.app.json
which also inherits roottsconfig.json
. I shifted the above snippet there and adjusted for relative file paths and then the error were gone.I hope anyone who runs into this issue doesn't have to spend all that much time on it. I wish
ng g web-worker
just worked in the first place for me.