Skip to content
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

🐛 BUG: vite.build.sourcemap does not generate sourcemaps for client-side components on build #3970

Closed
1 task
Tc-001 opened this issue Jul 18, 2022 · 8 comments · Fixed by #4195
Closed
1 task
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@Tc-001
Copy link
Contributor

Tc-001 commented Jul 18, 2022

What version of astro are you using?

1.0.0-beta.72

Are you using an SSR adapter? If so, which one?

none

What package manager are you using?

pnpm

What operating system are you using?

Linux

Describe the Bug

Sourcemaps are useful for debugging components while developing an application. But there are also tools (Ex. Sentry), that can use the sourcemaps in production to get a similar experience with in-the-wild bugs.

This functionality is currently unavailable however, as astro fails to generate soucemaps on build

The bug

  1. Clone and set up https://github.com/withastro/astro/tree/latest/examples/framework-svelte
  2. Set vite.build.sourcemap in astro.config.mjs to true
  3. Build the site

Expected: A sourcemap file (*.js.map) for each client-side script in ./dist, as well as the script itself referencing the sourcemap as per vite

Actual: an almost empty entry.mjs.map with no modifications to other files

{"version":3,"file":"entry.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

This was also in the build logs:

Sourcemap is likely to be incorrect: a plugin (astro:build) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
Sourcemap is likely to be incorrect: a plugin (astro:vite-plugin-env) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
...

Link to Minimal Reproducible Example

https://github.com/withastro/astro/tree/latest/examples/framework-svelte

Participation

  • I am willing to submit a pull request for this issue.
@Tc-001 Tc-001 changed the title 🐛 BUG: vite.build.sourcemap does not generate sourcemaps for client-side components 🐛 BUG: vite.build.sourcemap does not generate sourcemaps for client-side components on build Jul 18, 2022
@Tc-001
Copy link
Contributor Author

Tc-001 commented Jul 19, 2022

On a closer look there do seem to be some sourcemaps in ./dist/chunks, but they have the same issue as entry (they are almost completely blank) and are not referenced anywhere as far as I can see

(also maybe only for markdown pages? Unsure)

@natemoo-re
Copy link
Member

Ooh very strange! Thanks for opening an issue, I know digging into sourcemaps is definitely on our list.

This would be great to fix.

@natemoo-re natemoo-re added - P4: important Violate documented behavior or significantly impacts performance (priority) s3-large labels Jul 20, 2022
@pikeas
Copy link

pikeas commented Jul 31, 2022

Happening in dev as well in 1.0rc3:

[serve]    404 /@id/@astrojs/vue/@astrojs_vue_client__js.js.map

@matthewp
Copy link
Contributor

matthewp commented Aug 5, 2022

@natemoo-re I'm going to hand this one over to @bluwy.

@bluwy
Copy link
Member

bluwy commented Aug 5, 2022

Gimme

@matthewp
Copy link
Contributor

matthewp commented Aug 5, 2022

This would be a good one to create a test for.

@pikeas
Copy link

pikeas commented Aug 9, 2022

Still happening with 1.0.0.

$ npm run dev

> project@0.0.1 dev
> astro dev

  🚀  astro  v1.0.0 started in 59ms

  ┃ Local    http://localhost:3000/
  ┃ Network  use --host to expose

03:21:13 PM [serve]    404 /@id/astro/runtime/client/astro_runtime_client_hmr__js.js.map
03:21:13 PM [serve]    404 /@id/@astrojs/vue/@astrojs_vue_client__js.js.map

@bluwy
Copy link
Member

bluwy commented Aug 10, 2022

@pikeas I believe that's related to #4219 in dev mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants