lwc
lwc copied to clipboard
Use `disableSyntheticShadowSupport` to disable synthetic-specific compiler output
The compiler emits specific patterns for the benefit of synthetic shadow DOM:
@lwc/style-compiler- The
stylesheetfunction accepts the paramstoken(undefined for native shadow) as well asuseActualHostSelectoranduseNativeDirPseudoclass, which are always true for native shadow
- The
@lwc/template-compiler- "Scoped IDs" (
genScopedId), used to scope IDs in case of IDREF attributes likearia-labelledby lwc:dom=manualconfig, which is unused for native shadow
- "Scoped IDs" (
- (Maybe some other stuff I forgot)
In cases where synthetic shadow support is not needed, though (e.g. off-core), this generates extra code that contributes to the JS bundle size. For those cases, we can add a config like disableSyntheticShadowSupport which, when set to true, disables these synthetic-specific outputs.
This config could be passed to either @lwc/rollup-plugin or @lwc/compiler and would be plumbed through to sub-compilers that can use it (style compiler, template compiler, component compiler).
Checklist:
- [x] Optimize stylesheet output (#3229)
- [x] #3658
- [ ] #3659
- [ ] #4351
This issue has been linked to a new work item: W-12230270