[Feature Request]Support source-map can be disabled in development
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 696
- Avg merge
- 8m
- Merged PRs (30d)
- 7
Description
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
At now, sometimes we will get wrong sourcemap(https://github.com/facebook/metro/issues/148 https://github.com/facebook/metro/issues/380 https://github.com/microsoft/vscode-react-native/issues/928 https://github.com/Microsoft/vscode/issues/67987) generated and then cause us cant set breakpoint because when you set a breakpoint in the bundle.js, it will always jump to the wrong position of the corresponding source file.
So, if the source-map cant be disabled, then the breakpoint function is totally unavailable. And if we can disable it, at least we can set breakpoint in the bundle.js though it is not convenient to read.
What is the expected behavior?
BTW, seems we can set a customSerializer and change the argument, for example:
customSerializer: (entryPoint, prepend, graph, bundleOptions) => {
bundleOptions.sourceMapURL = undefined
return bundleToString(
baseJSBundle(entryPoint, prepend, graph, bundleOptions)
).code
}
But this is not a good idea for many reasons.
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
No need.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the customSerializer path and the bundleOptions.sourceMapURL argument shown in the issue; compare the behavior of baseJSBundle and bundleToString. Done should mean that a supported development configuration can omit source maps while still producing a usable bundle, with coverage for the resulting bundle output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100