-
Notifications
You must be signed in to change notification settings - Fork 12k
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
asyncToGenerator needs to be opt out in web workers #26200
Comments
Indeed, the With regards to the opting out of asyncToGenerator transformations, there is already a feature request here: #22191 |
@alan-agius4 |
That you'd need to log an issue with Webpack and wait until it's solved upstream. At this stage there is nothing actionable from our end to solve the |
@alan-agius4 Not that it will matter but I disagree with you on this. I learned a long time ago that as a developer if you choose to use a 3rd party library in your projects then you are responsible for it. How do I know that it is not your incorrect usage of webapck that is causing this issue. I as a developer am not using Webpack here. The Angular Cli is using Webpack. This team made the decision to use Webpack. I am going to log an issue with Webpack because it will probably be the faster option to resolve this issue. |
Hi @andrewalderson, I am happy to log an issue with Webpack myself, in the end it will not make much difference you will log it as long as it get resolved. That said, as you mentioned it will probably be faster if you log it yourself. One other thing to mention is that you could try to use the Esbuild based build system which will be released as stable in version 17 later next week. |
@alan-agius4 I did try the esbuild system but it didn't support Web Workers but I see that has now changed in v17. Thanks,I will give it a try. I will still open an issue with Webpack. |
Feel free to tag me if you need anything else. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build, serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Related #25708 #23546
In reading the linked issues above I understand why the
asyncToGenerator
code is added but there needs to be an opt-out option especially when using web workers. I ran into an issue when trying to implement sqlite3 wasm in an Angular project using the@sqlite.org/sqlite-wasm
package. I have it working except when running in a worker and using the Origin Private File System. The Angular Cli will addvar _asyncToGenerator = require("/{my local path}/node_modules/@angular-devkit/build-angular/node_modules/@babel/runtime/helpers/asyncToGenerator.js").default;
to the top of thesqlite3-opfs-async-proxy.js
file. This causes anUncaught ReferenceError: require is not defined
error.First, shouldn't this
require
statement have been converted to a___webpack-require___
on the dev server?Second, I know that the cli doesn't know this code is in a web worker so there needs to be a way for a developer to opt out of this behavior. I don't need
zone.js
or any Angular code running in my worker.The last problem is that the
require
statement is not removed in the production build. Shouldn't this code be inlined if it is required?Minimal Reproduction
https://stackblitz.com/edit/stackblitz-starters-fnwhlu
If you open the console you will see the errors when you run this.
Exception or Error
No response
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: