Children routes triggering Vite log error: '[vite] Pre-transform error: Failed to load url' #29132
Closed
1 task done
Labels
angular/build:dev-server
area: @angular/build
freq1: low
Only reported by a handful of users who observe it rarely
severity5: regression
type: bug/fix
Command
serve
Is this a regression?
The previous version in which this bug was not present was
19.0.0-next.1
Description:
Created new Angular standard SSR project (without the developer preview features) with 19.0.2 CLI about two weeks ago. But I only started to develop its features and routes today. Then I found this minor bug: when my path is redirected to a child route or when I refresh the child route's webpage, I keep getting vite log erros in my VSCode terminal (check 'Exception or Error' section further down).
This won't happen with routes that are notnested (that are not child or grandchild routes). I also tested without lazy-loading the children routes, and the problem persists. Another thing: the error also appears even if the route is not nested through the children or loadChildren properties, but simply by its path string, for example:
Nonetheless, the application seems to work normally, but I couldn't test a lot since there is not a lot of features yet in my application. If I run
ng build
and run the SSR default scriptnode dist/{project-name}/server/server.mjs
, there are no error logs at all.One thing that is interesting to mention is that if you look into my code, my application is set to redirect the root path to the authentication module, which has its own
<router-outlet />
, and then the module redirects the user to the 'authentication/#'. So, when I runng serve
and accesshttp://localhost:4200
, I go directly to the mentioned login route and page, and I see the Vite error log. But, if I remove the root route redirect to 'authentication' and create a navbar insideapp.component.html
with a routerLink property that targets the child route 'authentication/#', the first time the page is rendered, I see no error log, but if I refresh the page, Vite logs it in the console.My Code:
src/app/app.routes.ts
src\app\features\auth\presentation\shell\auth-shell.routes.ts
angular.json
Minimal Reproduction
I created a repository that replicates the problem: ng-19.0.2-vite-pre-transformer-error. Git clone the repo to your machine and run the commands:
*Make sure you have Node 22, Angular CLI 19 and pnpm 9 installed):
Then, access
http://localhost:4200
in your browser and navigate through the links on the top left of screen while watching your running terminal.Exception or Error
Your Environment
Anything else relevant?
Previous mentions of similar bugs and their PRs with fixes:
a)
ssr.entry
in Vite dev-server when available #28463b)
The text was updated successfully, but these errors were encountered: