Runtimes map to incorrect source files in source maps
See original GitHub issue🐛 bug report
Currently whenever a runtime asset gets created it maps to the runtime plugin in the sourcemap instead of the actual runtime asset.
The reason I’ve opened this issue is to provide some more context and figure out a proper solution for this as it’ll require some reworking in the core logic of runtimes and/or asset requests
Example:

🤔 Expected Behavior
Should map to the runtime’s generated code.
😯 Current Behavior
Maps to the source code of the runtime plugin
💁 Possible Solution
I’ve got 2 ideas on how to fix this:
-
Allow returning a sourcemap in the runtime plugin or generate one in applyRuntimes, both is currently impossible as
AssetRequestInputhas no sourcemap value. -
Implement some layer of virtual fs and create the files virtually.
🔦 Context
Trying to fix the remaining source map bugs
💻 Code Sample
import parcel from 'url:./parcel.webp';
console.log('test');
🌍 Your Environment
Current v2 branch
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
[Bug]: Incorrect sourcemaps in dev #1700 - remix-run ... - GitHub
@remix-run/server-runtime ... Breakpoint won't bound and I think this might happen because of incorrect paths to source files in sourcemaps.
Read more >What is wrong with SOURCE MAPS and how not to mess with ...
Sourcemaps map not a range of bytes in one file to a range in another, as a naive programmer might think. They only...
Read more >4 Reasons Why Your Source Maps are Broken - Sentry Blog
Here are four reasons why your source maps are broken and tips on how to fix them. ... Missing or incorrect source map...
Read more >Should I Use Source Maps in Production? | CSS-Tricks
A “source map” is a special file that connects a minified/uglified version of an asset (CSS or JavaScript) to the original authored version....
Read more >Map Preprocessed Code to Source Code - Chrome Developers
When running Source Maps in DevTools, you'll notice that the JavaScript isn't compiled and you can see all the individual JavaScript files it ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I like the idea of returning a source map from runtimes as part of assetrequestinput. But in most cases the source map should basically be an empty map that’s 1:1 with the code, so maybe in the transformer when AssetRequestInput has a code property it could automatically generate an empty map if none is available?
this issue is still in v1 version~