Skip to content

The above dynamic import cannot be analyzed by Vite. #59764

@mmonteroewp

Description

@mmonteroewp

Which @angular/* package(s) are the source of the bug?

compiler-cli

Is this a regression?

Yes

Description

I upgraded to Angular 19.1 and activated HMR.
I am using the @angular/build:dev-server builder.
When I run "ng server" and as soon as I open my app, I get several warnings on the terminal console regarding Vite not able to analyze Dynamic imports.
I don't have dynamic imports, except for Lazy Loading components.
The warnings seem to be related to Lazy Loading and they disappear if I turn HMR off.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

12:46:39 PM [vite] (client) warning: 
/media/mario/Lin-Dev/repos/SmartFactory/EWP.SF.FrontTemplate/.angular/vite-root/SmartFactory/chunk-PVDRENNO.js
395|  (() => {
396|    function TwostepComponent_HmrLoad(t) {
397|      import(new URL("./@ng/component?c=src%2Fapp%2Fcore%2Fauth%2Ftwostep%2Ftwostep.component.ts%40TwostepComponent&t=" + encodeURIComponent(t), import.meta.url).href).then((m) => m.default && i02.\u0275\u0275replaceMetadata(TwostepComponent, m.default, [i02, i12, i22, i32], [NgOtpInputComponent2, TranslateModule2, ReactiveFormsModule2, NgOtpInputModule2, RouterLink, SetupDetailComponent]));
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
398|    }
399|    (typeof ngDevMode === "undefined" || ngDevMode) && TwostepComponent_HmrLoad(Date.now());
The above dynamic import cannot be analyzed by Vite.
See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.

  Plugin: vite:import-analysis
  File: /media/mario/Lin-Dev/repos/SmartFactory/EWP.SF.FrontTemplate/.angular/vite-root/SmartFactory/chunk-PVDRENNO.js

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 19.1.4
Node: 23.6.0 (Unsupported)
Package Manager: pnpm 9.15.4
OS: linux x64

Angular: 19.1.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1901.4 (cli-only)
@angular-devkit/core         19.1.4 (cli-only)
@angular-devkit/schematics   19.1.4 (cli-only)
@angular/build               19.1.4
@angular/cdk                 19.1.1
@angular/cli                 19.1.4
@angular/material            19.1.1
@schematics/angular          19.1.4 (cli-only)
rxjs                         7.8.1
typescript                   5.7.3

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions