diff --git a/packages/server-renderer/__tests__/ssrSlot.spec.ts b/packages/server-renderer/__tests__/ssrSlot.spec.ts index a68569ca..baf8f227 100644 --- a/packages/server-renderer/__tests__/ssrSlot.spec.ts +++ b/packages/server-renderer/__tests__/ssrSlot.spec.ts @@ -49,6 +49,36 @@ describe('ssr: slot', () => { ).toBe(`
`) }) + test('empty slot (manual comments)', async () => { + expect( + await renderToString( + createApp({ + components: { + one: { + template: `
` + } + }, + template: `` + }) + ) + ).toBe(`
`) + }) + + test('empty slot (multi-line comments)', async () => { + expect( + await renderToString( + createApp({ + components: { + one: { + template: `
` + } + }, + template: `` + }) + ) + ).toBe(`
`) + }) + test('multiple elements', async () => { expect( await renderToString( diff --git a/packages/server-renderer/src/helpers/ssrRenderSlot.ts b/packages/server-renderer/src/helpers/ssrRenderSlot.ts index 9234e517..8f746ec1 100644 --- a/packages/server-renderer/src/helpers/ssrRenderSlot.ts +++ b/packages/server-renderer/src/helpers/ssrRenderSlot.ts @@ -82,7 +82,7 @@ export function ssrRenderSlotInner( } } -const commentRE = //g +const commentRE = //gm function isComment(item: SSRBufferItem) { return ( typeof item === 'string' &&