feature/use-defineComponent-function-name-in-__DEV__ #1661
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Continuing from discussions about stateful functions as components (#1645), I thought if it wouldn't help devtools and debugging experience to extract the name from the function when in
__DEV__
mode.Using the file name makes sense in SFCs but in js/jsx/ts/tsx files you can define multiple small component.
Users can define name option property on object components but this tries to extract the name from a function provided instead.
It works when defining components like constants:
or functions:
but this won't give any name (which is expected):
nor this (can possibly be picked up by the dev bundler though):
The alternative would be to look into Component.setup.name in the formatComponentName function, but I'm not sure about when the name is supposed to be set in that case.