Skip to content

HMR error [plugin:vite:import-analysis] Failed to resolve import #29369

Closed
@blueiceprj

Description

@blueiceprj

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

core

Is this a regression?

Yes

Description

HMR is enabled on my project (--hmr). When I change some code on template or ts file getting some like that error. Here details.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

[plugin:vite:import-analysis] Failed to resolve import "./chunk-4JZSMU2G.js" from ".angular/vite-root/..../main.js". Does the file exist?
/........./.angular/vite-root/...../main.js:9:9
7  |  import {
8  |    AuthGuard
9  |  } from "./chunk-4JZSMU2G.js";
   |          ^
10 |  import {
11 |    UserRouteAccessService
    at TransformPluginContext._formatError (file:///......node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:47397:41)
    at TransformPluginContext.error (file:///......./node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:47392:16)
    at normalizeUrl (file:///....../node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:45642:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async file:///...../node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:45761:39
    at async Promise.all (index 2)
    at async TransformPluginContext.transform (file:///...../node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:45688:7)
    at async EnvironmentPluginContainer.transform (file:///..../node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:47223:18)
    at async loadAndTransform (file:///...../node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:41034:27)
    at async viteTransformMiddleware (file:///...../node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js

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

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 19.1.1
Node: 22.12.0
Package Manager: npm 11.0.0
OS: darwin x64

Angular: 19.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                              Version
--------------------------------------------------------------
@angular-devkit/architect            0.1901.1
@angular-devkit/build-angular        19.1.1
@angular-devkit/build-ng-packagr     0.1002.0
@angular-devkit/core                 19.1.1 (cli-only)
@angular-devkit/schematics           19.1.1
@angular/cdk                         19.0.5
@angular/material                    19.0.5
@angular/material-date-fns-adapter   19.0.5
@angular/youtube-player              19.0.5
@schematics/angular                  19.1.1
rxjs                                 7.8.1
typescript                           5.7.3
zone.js                              0.15.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions