Skip to content

Angular 19.1.3 SSR Vite Crash on every reload HMR disabled #29443

Description

@us77ipis

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

No response

Description

After updating from 19.0.x to 19.1.3 even with HMR disabled ng serve crashes any time I update any file.

Looks similar to #29424, but happens also with HMR disabled.

Minimal Reproduction

Run ng serve --no-hmr

Exception or Error

[vite] (ssr) Error when evaluating SSR module /main.server.mjs:
|- Error: [vite] cannot find entry point module '/main.server.mjs'.
    at fetchModule (file:///app/frontend/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:51477:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async handleInvoke (file:///app/frontend/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:44166:22)
    at async EventEmitter.listenerForInvokeHandler (file:///app/frontend/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:44239:19)

An unhandled exception occurred: [vite] cannot find entry point module '/main.server.mjs'.

Your Environment

Angular CLI: 19.1.3
Node: 22.12.0
Package Manager: npm 10.9.0
OS: linux x64

Angular: 19.1.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1901.3
@angular-devkit/build-angular   19.1.3
@angular-devkit/core            19.1.3
@angular-devkit/schematics      19.1.3
@angular/cdk                    19.1.0
@angular/cli                    19.1.3
@angular/material               19.1.0
@angular/ssr                    19.1.3
@schematics/angular             19.1.3
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else relevant?

No response

Activity

  1. alan-agius4 commented on Jan 22, 2025

    @alan-agius4
    Collaborator

    This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

    You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

    This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

  2. added
    needs: repro steps
    on Jan 22, 2025
  3. us77ipis commented on Jan 22, 2025

    @us77ipis
    Author

    I'll continue trying to create a minimal example, though I have not achieved reproduction of the issue starting with a fresh project so far.

    Here the ng version output from before the update that caused the issue, in case that helps:

    Angular CLI: 19.0.4
    Node: 22.12.0
    Package Manager: npm 10.9.0
    OS: linux x64
    
    Angular: 19.0.3
    ... animations, common, compiler, compiler-cli, core, forms
    ... platform-browser, platform-browser-dynamic, platform-server
    ... router, service-worker
    
    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/cdk                    19.0.4
    @angular/cli                    19.0.4
    @angular/material               19.0.4
    @angular/ssr                    19.0.4
    @schematics/angular             19.0.4
    rxjs                            7.8.1
    typescript                      5.6.3
    zone.js                         0.15.0
    
  4. rmlira commented on Jan 23, 2025

    @rmlira

    same issue here, for a new project I just have included the app-shell:

    ng generate app-shell

    and then created a lazy loaded route:

    export const routes: Routes = [
      {
    		path: '',
    		children: [
    			{
    				path: '',
    				loadComponent: () => import('./home/home.component').then((m) => m.HomeComponent),
    				title: 'Welcome Home',
    			},
    		],
    	}
    ];
    

    every time I edit the homeComponent it throws me the same error:

    [error] Error: [vite] cannot find entry point module '/main.server.mjs'.
        at fetchModule (file:///C:/Users/myUser/Documents/Workspace/Intern/temp/ng/tai/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:51477:13)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async handleInvoke (file:///C:/Users/myUser/Documents/Workspace/Intern/temp/ng/tai/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:44166:22)
        at async EventEmitter.listenerForInvokeHandler (file:///C:/Users/myUser/Documents/Workspace/Intern/temp/ng/tai/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:44239:19)
    

    configuration:

    Angular CLI: 19.1.4
    Node: 20.17.0
    Package Manager: npm 10.8.2
    OS: win32 x64
    
    Angular: 19.1.3
    ... animations, common, compiler, compiler-cli, core, forms
    ... platform-browser, platform-browser-dynamic, platform-server
    ... router
    
    Package                         Version
    ---------------------------------------------------------
    @angular-devkit/architect       0.1901.4
    @angular-devkit/build-angular   19.1.4
    @angular-devkit/core            19.1.4
    @angular-devkit/schematics      19.1.4
    @angular/cli                    19.1.4
    @angular/ssr                    19.1.4
    @schematics/angular             19.1.4
    rxjs                            7.8.1
    typescript                      5.7.3
    zone.js                         0.15.0
    

    new project commands;

    ng new --create-application false --new-project-root apps --package-manager npm --skip-git --skip-install --strict
    
    ng generate application appTest --strict --skip-install --style=css --ssr=N
    
  5. added
    freq1: low
    and removed
    needs: repro steps
    on Jan 23, 2025
  6. self-assigned this
    on Jan 23, 2025
  7. us77ipis commented on Jan 29, 2025

    @us77ipis
    Author

    Still having this issue with 19.1.5, so #29462 did not fix the issue I believe.

    Angular CLI: 19.1.5
    Node: 22.13.1
    Package Manager: npm 10.9.2
    OS: linux x64
    
    Angular: 19.1.3
    ... animations, common, compiler, compiler-cli, core, forms
    ... platform-browser, platform-browser-dynamic, platform-server
    ... router, service-worker
    
    Package                         Version
    ---------------------------------------------------------
    @angular-devkit/architect       0.1901.5
    @angular-devkit/build-angular   19.1.5
    @angular-devkit/core            19.1.5
    @angular-devkit/schematics      19.1.5
    @angular/cdk                    19.1.1
    @angular/cli                    19.1.5
    @angular/material               19.1.1
    @angular/ssr                    19.1.5
    @schematics/angular             19.1.5
    rxjs                            7.8.1
    typescript                      5.6.3
    zone.js                         0.15.0
    
  8. added 2 commits that reference this issue on Jan 30, 2025
    cce45df
    59b15e0
  9. added a commit that references this issue on Jan 30, 2025
    45abd15
  10. added a commit that references this issue on Jan 30, 2025
    9b0d730
  11. angular-automatic-lock-bot commented on Mar 2, 2025

    @angular-automatic-lock-bot

    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.

  12. locked and limited conversation to collaborators on Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions