Skip to content

new text loader in 17.1.0-rc.1 doesn't load files from node_modules #26866

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

Closed
jnizet opened this issue Jan 14, 2024 · 2 comments · Fixed by #26923
Closed

new text loader in 17.1.0-rc.1 doesn't load files from node_modules #26866

jnizet opened this issue Jan 14, 2024 · 2 comments · Fixed by #26923

Comments

@jnizet
Copy link
Contributor

jnizet commented Jan 14, 2024

Command

serve

Is this a regression?

  • No

Description

Using the new loader support in version 17.1 to load the content of a file as text using an import statement works fine, but not when the file is under node_modules, unless using a complete relative path such as ../../node_modules/bootstrap-icons/icons/save.svg.

When using the path that looks more logical to me (bootstrap-icons/icons/save.svg), then the CLI outputs a warning in the console:

Cannot optimize dependency: bootstrap-icons/icons/save.svg, present in 'optimizeDeps.include'

and instead of loading the file content, it loads the text /@fs/home/projects/stackblitz-starters-ycv7cm/repro/node_modules/bootstrap-icons/icons/save.svg

Minimal Reproduction

https://stackblitz.com/edit/stackblitz-starters-ycv7cm?file=repro%2Fsrc%2Fapp%2Fapp.component.ts

  • cd repro
  • npm i
  • ng serve

Exception or Error

No response

Your Environment

Angular CLI: 17.1.0-rc.1
Node: 18.18.0
Package Manager: npm 9.4.2
OS: linux x64

Angular: 17.1.0-rc.0
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1701.0-rc.1
@angular-devkit/build-angular   17.1.0-rc.1
@angular-devkit/core            17.1.0-rc.1
@angular-devkit/schematics      17.1.0-rc.1
@angular/cli                    17.1.0-rc.1
@schematics/angular             17.1.0-rc.1
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.3

Anything else relevant?

No response

@reduckted
Copy link

I've just run into this problem as well. Thanks for pointing out that a relative path can be used as a workaround. I didn't think to try that.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants