Timeline for Can an LWC component get its own name?
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 18, 2020 at 16:14 | comment | added | Matthew Souther | You're right, Kevin. I wasn't aware of Oleh's solution at the time I posted this. I would use his approach if I was implementing this today. | |
Nov 17, 2020 at 18:24 | comment | added | Kevin Venkiteswaran | There's a MAJOR caveat of this approach: the stack trace in errors is not an API. It may change at any time. Aka this logic will break unannounced. Programmatic access to the rendered tag name is a good feature request. I recommend filing an issue at github.com/salesforce/lwc/issues. If you have a view on namespace vs not it'd be valuable to state that in the git issue. | |
Nov 13, 2020 at 17:46 | comment | added | Matthew Souther |
Thanks! Just realized there was a disconnect in my original answer. It supported a stack file reference like (modules/mynamespace/lwcApp.js:4) but not one like (lwcApp.js:4) , should that kind of thing ever occur. Added support for the open parenthesis as a delimiter in addition to the forward slash.
|
|
Nov 13, 2020 at 17:41 | history | edited | Matthew Souther | CC BY-SA 4.0 |
Improve answer to support when the js file is at the root of the directory
|
Nov 13, 2020 at 9:44 | comment | added | Dane | Hello Matthew. Thanks for taking the time and making such a thorough answer. | |
Nov 13, 2020 at 9:41 | vote | accept | Dane | ||
Nov 19, 2020 at 10:23 | |||||
Nov 13, 2020 at 6:02 | history | answered | Matthew Souther | CC BY-SA 4.0 |