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

[⚡ Feature]: Generate source maps #724

Open
1 task
levi opened this issue Mar 27, 2024 · 1 comment
Open
1 task

[⚡ Feature]: Generate source maps #724

levi opened this issue Mar 27, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@levi
Copy link

levi commented Mar 27, 2024

Description

Unclear to me if this is supported or not at the moment, but wanted to flag it in case not.

My error handler, Sentry, needs source maps to map the minified stacktraces to my repo source. Currently, my webpack next.js build outputs source maps for files like this:

~/_next/static/chunks/1249.d9777ee89355e4b6.js

While the errors reported come out of Cloudflare pages like this:

__next-on-pages-dist__/webpack/62d6966c94b522734ceb09853b489431.js

Is there currently a known way to do this? I haven't been able to find anything documented or in the source.

Additional Information

No response

Would you like to help?

  • Would you like to help implement this feature?
@levi levi added the enhancement New feature or request label Mar 27, 2024
@james-elicx
Copy link
Contributor

We don't currently generate any sort of source map. I've spoken to someone else about this before and I personally don't think it's something that would be possible with how our tooling currently works. I may be wrong so feel free to chime in if someone disagrees with what I'm writing.

Our final worker is several steps of processing away from your source code. Your source code gets built by Next.js, it then gets transformed again by Vercel's CLI and everything is inlined into one file for each edge-runtime route, and then we process that again to generate the final worker.

The part where I think this gets tricky and near-impossible to generate source maps for is how we process the code. We take all of the Vercel functions and then dedupe and minify all the functions. The deduping process then means that we could have one code snippet for a webpack chunk that is shared by 20 different edge functions generated by the Vercel CLI, instead of there being one for each file. So all of a sudden, we have all these chunks split out of the route files that can map towards a variety of different files, thereby (i assume) making it incredibly hard to try and generate a useful source map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants