Skip to content

Vite 404 error in VS Code debug console: Could not read source map... #27136

@johnnygerard

Description

@johnnygerard

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

When running ng serve as well as on page reload, the VS Code debug console displays a 404 error message.

I was able to get rid of the error message by setting the resolveSourceMapLocations config option in .vscode/launch.json, but this fix prevents breakpoints from being hit.

Config tested:

{
  "name": "ng serve",
  "type": "chrome",
  "request": "launch",
  "preLaunchTask": "npm: start",
  "url": "http://localhost:4200/",
  "resolveSourceMapLocations": [
    "${workspaceFolder}/**",
    "!**/node_modules/**"
  ],
}

Minimal Reproduction

  1. Create default Angular project: ng new app --defaults
  2. Open in VS Code: code app
  3. Press F5 key to use default launch configuration and check the VS Code debug console.

Exception or Error

Could not read source map for http://localhost:4200/@vite/client: Unexpected 404 response from http://localhost:4200/@vite/client.mjs.map: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /@vite/client.mjs.map</pre>
</body>
</html>

[vite] connecting...
client:426
[vite] connected.
client:521
Angular is running in development mode.
core.mjs:30679

Your Environment

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

Angular CLI: 17.2.0
Node: 18.19.1
Package Manager: npm 10.4.0
OS: linux x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1702.0
@angular-devkit/build-angular   17.2.0
@angular-devkit/core            17.2.0
@angular-devkit/schematics      17.2.0
@angular/cli                    17.2.0
@schematics/angular             17.2.0
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.4

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions