Skip to content

Commit da23cd0

Browse files
committed
fix: invalid slot-fn identifier when lwc:component is used
1 parent 6a408d2 commit da23cd0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/@lwc/ssr-compiler/src/compile-template/transformers/component/slotted-content.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,9 @@ export function getSlottedContent(
281281
const uniqueNodeId = `${node.name}:${node.location.start}:${node.location.end}`;
282282

283283
if (hasShadowSlottedContent && !cxt.slots.shadow.isDuplicate(uniqueNodeId)) {
284-
// cxt.hoist.templateFn(slotAttributeValueAssignment, slotAttributeValueAssignment);
285-
const kebabCmpName = kebabCaseToCamelCase(node.name);
284+
// Colon characters in <lwc:component> element name will result in an invalid
285+
// JavaScript identifier if not otherwise accounted for.
286+
const kebabCmpName = kebabCaseToCamelCase(node.name).replace(':', '_');
286287
const shadowSlotContentFnName = cxt.slots.shadow.register(uniqueNodeId, kebabCmpName);
287288
const shadowSlottedContentFn = bGenerateShadowSlottedContent(
288289
b.identifier(shadowSlotContentFnName),

0 commit comments

Comments
 (0)