Repository navigation
Closed
Copy link
Labels
area: @angular/builddevkit/build-angular:dev-serverfreq1: lowOnly reported by a handful of users who observe it rarelyseverity5: regressiontype: bug/fix
Description
Command
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
19.0.2
Description
After updating the angular cli to 19.0.4, i can no longer serve my project, the issue comes from the usage of pdfjs-dist that includes usage of nodejs build-ins. however i am able to build successfully which contradicts with the goal fc41f50
My expecation is a workaround this build blocking error (probably through the compiler configuration) and the consistency of errors between serving and build.
Minimal Reproduction
- create a new angular project
- install any library that uses nodejs build-ins in my case [email protected]
- try to serve/build
here's the repo to reproduce it: https://github.com/Deku-nattsu/nodejs-build-ins-error
stackblitz: https://stackblitz.com/~/github.com/Deku-nattsu/nodejs-build-ins-error
Exception or Error
when serving:
[ERROR] The package "url" wasn't found on the file system but is built into node. [plugin angular-browser-node-built-in]
node_modules/pdfjs-dist/build/pdf.mjs:5666:48:
5666 │ url = await import(/*webpackIgnore: true*/"url");
╵ ~~~~~
✘ [ERROR] The package "fs" wasn't found on the file system but is built into node. [plugin angular-browser-node-built-in]
node_modules/pdfjs-dist/build/pdf.mjs:5663:51:
5663 │ const fs = await import(/*webpackIgnore: true*/"fs"),
╵ ~~~~
✘ [ERROR] The package "http" wasn't found on the file system but is built into node. [plugin angular-browser-node-built-in]
node_modules/pdfjs-dist/build/pdf.mjs:5664:49:
5664 │ http = await import(/*webpackIgnore: true*/"http"),
╵ ~~~~~~
✘ [ERROR] The package "https" wasn't found on the file system but is built into node. [plugin angular-browser-node-built-in]
node_modules/pdfjs-dist/build/pdf.mjs:5665:50:
5665 │ https = await import(/*webpackIgnore: true*/"https"),
╵ ~~~~~~~
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 19.0.4
Node: 20.15.1
Package Manager: npm 10.7.0
OS: win32 x64
Angular: 19.0.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1900.4
@angular-devkit/build-angular 19.0.4
@angular-devkit/core 19.0.4
@angular-devkit/schematics 19.0.4
@angular/cli 19.0.4
@schematics/angular 19.0.4
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0
Anything else relevant?
No response
Reacted by Dmitry Zakharov, Laforge Thomas, Mariam Al, Burak, klausj, Ivan Soroka, Oussama Essamadi, Immanuel Becker, Yurii, Younes Chekkour and 5 more
Metadata
Metadata
Assignees
Labels
area: @angular/builddevkit/build-angular:dev-serverfreq1: lowOnly reported by a handful of users who observe it rarelyseverity5: regressiontype: bug/fix
Activity
pumano commentedon Dec 6, 2024
got same problems with
falsolibrary after commit landed to 19.0.4. I create issue: https://github.com/ngneat/falso/issues/386Looks like
seedrandomlibrary under the hood properly handle what to use, for nodejs usesrequire('crypto')while in browser use windowglobal.cryptoisoroka-plana commentedon Dec 8, 2024
I also started getting this issue after updating to
19.0.4from Angular 18.It used to work without any issues before and I inspected the code of these packages they all check what environment they are running in before running those
requirecalls so the build shouldn't try to attempt to bundle them for the browser.I am using
@angular-devkit/build-angular:browser-esbuild.I can confirm this issue is gone when downgrading to
19.0.3.eoussama commentedon Dec 8, 2024
bump
ngadceser commentedon Dec 9, 2024
"only 19.0.4 --- I'm currently just observing since the same error occurred with
nodecrypto = require('crypto');above."revert: fix(@angular/build): show error when Node.js built-ins are us…
revert: fix(@angular/build): show error when Node.js built-ins are us…
revert: fix(@angular/build): show error when Node.js built-ins are us…
revert: fix(@angular/build): show error when Node.js built-ins are us…
Deku-nattsu commentedon Dec 9, 2024
@alan-agius4 Thanks :)
angular-automatic-lock-bot commentedon Jan 12, 2025
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.