Skip to content

Failed to resolve import "./chunks/helpers.segment.js" from ".angular/vite-root/project_name/scripts.js". #28259

@kartikth40

Description

@kartikth40

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

Angular v16

Description

I have migrated a project to Angular v18 and on running ng serve got this error on runtime -

...
Watch mode enabled. Watching for file changes...
NOTE: Raw file sizes do not reflect development server per-request transformations.
One or more browsers which are configured in the project's Browserslist configuration will be ignored as ES5 output is not supported by the Angular CLI.
Ignored browsers: kaios 2.5, op_mini all
  ➜  Local:   http://localhost:4200/
  ➜  press h + enter to show help
1:14:31 PM [vite] Internal server error: Failed to resolve import "./chunks/helpers.segment.js" from ".angular/vite-root/project_name/scripts.js". Does the file exist?
  Plugin: vite:import-analysis
  File: C:/microservices/project_name/.angular/vite-root/project_name/scripts.js:6:901
...

Minimal Reproduction

The error occurs on runtime during the following command execution -
ng serve

Exception or Error

No response

Your Environment

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

Angular CLI: 18.2.0
Node: 20.16.0
Package Manager: npm 10.8.1
OS: win32 x64

Angular: 18.2.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, material-luxon-adapter
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.0
@angular-devkit/build-angular   18.2.0
@angular-devkit/core            18.2.0
@angular-devkit/schematics      18.2.0
@schematics/angular             18.2.0
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.10

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions