Skip to content

Invalid relative paths in sourcemap "sources" under .output/public #32009

@IlyaSemenov

Description

@IlyaSemenov

Environment

  • Operating System: Linux
  • Node Version: v20.19.1
  • Nuxt Version: 3.17.2
  • CLI Version: 3.25.0
  • Nitro Version: 2.11.11
  • Package Manager: npm@10.8.2
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/nuxt-starter-ojzodcbq

In the reproduction repo, run npm run build, then check "sources" in any of the source maps:

~/projects/nuxt-starter-fajroeah
❯ cd .output/public/_nuxt/

~/projects/nuxt-starter-fajroeah/.output/public/_nuxt
❯ head -c 200 Dwmq4gRZ.js.map
{"version":3,"file":"Dwmq4gRZ.js","sources":["../../../../node_modules/nuxt/dist/app/components/error-500.vue"],"sourcesContent":["<script setup>\nimport { useHead } from \"#imports\";\nconst props = 

~/projects/nuxt-starter-fajroeah/.output/public/_nuxt
❯ cat ../../../../node_modules/nuxt/dist/app/components/error-500.vue
cat: ../../../../node_modules/nuxt/dist/app/components/error-500.vue: No such file or directory

Describe the bug

After nuxt build, sourcemaps under .output/public/_nuxt/*.map, specifically the "sources" lists, are invalid (they point to missing files).

Additional context

I understand that Nuxt builds the initial build under .nuxt/dist/client and then prepares .output/public in a separate step; the *.map files are copied verbatim and no wonder the relative paths become invalid. However, I believe Nuxt should post-process copied sourcemaps and fix relative source paths, otherwise the tooling breaks when it consumes the sourcemaps from .output (such as when I upload them to Sentry).

Logs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions