Add option for generating *named* module factories
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 696
- Avg merge
- 8m
- Merged PRs (30d)
- 7
Description
_ I was blind, but now I see_
Hi, I'm profiling a RN app, and I'm looking into time it takes to do all the imports at app startup. Here's what the profiler could show me out of the box:
Nothing. I see minor clues here and there, but I don't know which files correspond to which boxes. Absolutely useless.
I made a very minor change to Metro to spit out Modules like so:
// (normally this function is anonymous)
__d(function ____app_components_TaskDetails_CommentsList_helpers_js(/* ... */) {
And now, the profiling experience is completely transformed:
I don't have a proper patch at this time, but it's literally a ~10LOC change: https://gist.github.com/radex/cc0e443f019bc0f94a76fcbd9200b48e
It would be quite trivial to add this to dev mode/profiling mode/under a flag, and if not — I'm making this post in case my contraption is useful to anyone else
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 linked ~10-line gist and trace Metro's module-factory generation path. Add an opt-in mode or flag that emits names derived from module paths, then verify that profiling output identifies the corresponding files without changing the default output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 43/100