Description
Command
build, serve
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
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 add var _asyncToGenerator = require("/{my local path}/node_modules/@angular-devkit/build-angular/node_modules/@babel/runtime/helpers/asyncToGenerator.js").default;
to the top of the sqlite3-opfs-async-proxy.js
file. This causes an Uncaught 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
node ➜ /workspaces/angular-worker-sqlite3-wasm (main) $ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 16.2.9
Node: 18.18.0
Package Manager: npm 9.8.1
OS: linux x64
Angular: 16.2.11
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1602.9
@angular-devkit/build-angular 16.2.9
@angular-devkit/core 16.2.9
@angular-devkit/schematics 16.2.9
@angular/cli 16.2.9
@schematics/angular 16.2.9
rxjs 7.8.1
typescript 5.1.6
zone.js 0.13.3
Anything else relevant?
No response