Skip to content

Vite dev server fails to serve source maps #26199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
yharaskrik opened this issue Nov 1, 2023 · 1 comment · Fixed by #26222
Closed
1 task

Vite dev server fails to serve source maps #26199

yharaskrik opened this issue Nov 1, 2023 · 1 comment · Fixed by #26222

Comments

@yharaskrik
Copy link

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

17.0.0-rc.3

Description

When generating a fresh application with npm init @angular@next --ssr the application fails to load the sourcemaps when you open the dev tools.

Watch mode enabled. Watching for file changes...
  ➜  Local:   http://localhost:4200/
ERROR RuntimeError: NG04002: Cannot match any routes. URL Segment: '@vite/client.mjs.map'
    at Recognizer.noMatchError (/Users/jaybell/packages/router/src/recognize.ts:61:12)
    at <anonymous> (/Users/jaybell/packages/router/src/recognize.ts:101:20)
    at /Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/operators/catchError.js:13:51
    at OperatorSubscriber._this._error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:43:21)
    at Subscriber.error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)
    at Subscriber.error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)
    at Subscriber.error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30) {
  code: 4002
}
ERROR RuntimeError: NG04002: Cannot match any routes. URL Segment: 'styles.css.map'
    at Recognizer.noMatchError (/Users/jaybell/packages/router/src/recognize.ts:61:12)
    at <anonymous> (/Users/jaybell/packages/router/src/recognize.ts:101:20)
    at /Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/operators/catchError.js:13:51
    at OperatorSubscriber._this._error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:43:21)
    at Subscriber.error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)
    at Subscriber.error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)
    at Subscriber.error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/Users/jaybell/WebstormProjects/angular-17-ssr-application-builder/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30) {
  code: 4002
}

In our private monorepo when I port the configurations for the application builder I get a slightly different but same case, I run into the same sourcemap error but instead if just crashes the server

Cannot optimize dependency: path, present in 'optimizeDeps.include'
  ➜  Local:   http://localhost:60926/
file:///Users/jaybell/WebstormProjects/shinkansen/node_modules/@angular/router/fesm2022/router.mjs:3695
        return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
               ^

RuntimeError: NG04002: Cannot match any routes. URL Segment: '@vite/client.mjs.map'
    at Recognizer.noMatchError (file:///Users/jaybell/WebstormProjects/shinkansen/node_modules/@angular/router/fesm2022/router.mjs:3695:16)
    at file:///Users/jaybell/WebstormProjects/shinkansen/node_modules/@angular/router/fesm2022/router.mjs:3724:28
    at /Users/jaybell/WebstormProjects/shinkansen/node_modules/rxjs/dist/cjs/internal/operators/catchError.js:13:51
    at OperatorSubscriber._this._error (/Users/jaybell/WebstormProjects/shinkansen/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:43:21)
    at Subscriber.error (/Users/jaybell/WebstormProjects/shinkansen/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/Users/jaybell/WebstormProjects/shinkansen/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)
    at Subscriber.error (/Users/jaybell/WebstormProjects/shinkansen/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/Users/jaybell/WebstormProjects/shinkansen/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)
    at Subscriber.error (/Users/jaybell/WebstormProjects/shinkansen/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/Users/jaybell/WebstormProjects/shinkansen/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30) {
  code: 4002
}

Node.js v18.18.2

Minimal Reproduction

npm init @angular@next --ssr
ng serve
Open the app
Open the devtools

Exception or Error

No response

Your Environment

Angular CLI: 17.0.0-rc.3
Node: 18.18.2
Package Manager: npm 9.8.1
OS: darwin arm64

Angular: 17.0.0-rc.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0-rc.3
@angular-devkit/build-angular   17.0.0-rc.3
@angular-devkit/core            17.0.0-rc.3
@angular-devkit/schematics      17.0.0-rc.3
@angular/cli                    17.0.0-rc.3
@angular/ssr                    17.0.0-rc.3
@schematics/angular             17.0.0-rc.3
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.1

Anything else relevant?

No response

@alan-agius4 alan-agius4 self-assigned this Nov 3, 2023
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Nov 3, 2023
Unlike assets, output file were not prefixed with a `/`. This change alings these and now files are always prefixed with a slash.

Closes angular#26215 and closes angular#26199
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Nov 3, 2023
Unlike assets, output file were not prefixed with a `/`. This change alings these and now files are always prefixed with a slash.

Closes angular#26215 and closes angular#26199
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Nov 3, 2023
…ath with extensions

Do not try to SSR a request that has extensions.

Closes angular#26199
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Nov 3, 2023
…ath with extensions

Do not try to SSR a request that has extensions.

Closes angular#26199
alan-agius4 added a commit that referenced this issue Nov 3, 2023
…ath with extensions

Do not try to SSR a request that has extensions.

Closes #26199
alan-agius4 added a commit that referenced this issue Nov 3, 2023
…ath with extensions

Do not try to SSR a request that has extensions.

Closes #26199

(cherry picked from commit 98a61ff)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.