diff --git a/packages/compiler-ssr/__tests__/ssrPortal.spec.ts b/packages/compiler-ssr/__tests__/ssrPortal.spec.ts index e5a6bad1289..bb08b3024f7 100644 --- a/packages/compiler-ssr/__tests__/ssrPortal.spec.ts +++ b/packages/compiler-ssr/__tests__/ssrPortal.spec.ts @@ -2,7 +2,7 @@ import { compile } from '../src' describe('ssr compile: teleport', () => { test('should work', () => { - expect(compile(`
`).code) + expect(compile(`
`).code) .toMatchInlineSnapshot(` "const { ssrRenderTeleport: _ssrRenderTeleport } = require(\\"@vue/server-renderer\\") @@ -15,9 +15,8 @@ describe('ssr compile: teleport', () => { }) test('disabled prop handling', () => { - expect( - compile(`
`).code - ).toMatchInlineSnapshot(` + expect(compile(`
`).code) + .toMatchInlineSnapshot(` "const { ssrRenderTeleport: _ssrRenderTeleport } = require(\\"@vue/server-renderer\\") return function ssrRender(_ctx, _push, _parent, _attrs) { @@ -28,8 +27,7 @@ describe('ssr compile: teleport', () => { `) expect( - compile(`
`) - .code + compile(`
`).code ).toMatchInlineSnapshot(` "const { ssrRenderTeleport: _ssrRenderTeleport } = require(\\"@vue/server-renderer\\") diff --git a/packages/compiler-ssr/src/errors.ts b/packages/compiler-ssr/src/errors.ts index 1ac3798dc5a..a1e057a78c2 100644 --- a/packages/compiler-ssr/src/errors.ts +++ b/packages/compiler-ssr/src/errors.ts @@ -26,6 +26,6 @@ export const enum SSRErrorCodes { export const SSRErrorMessages: { [code: number]: string } = { [SSRErrorCodes.X_SSR_CUSTOM_DIRECTIVE_NO_TRANSFORM]: `Custom directive is missing corresponding SSR transform and will be ignored.`, [SSRErrorCodes.X_SSR_UNSAFE_ATTR_NAME]: `Unsafe attribute name for SSR.`, - [SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET]: `No target prop on teleport element.`, + [SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET]: `Missing the 'to' prop on teleport element.`, [SSRErrorCodes.X_SSR_INVALID_AST_NODE]: `Invalid AST node during SSR transform.` } diff --git a/packages/compiler-ssr/src/transforms/ssrTransformTeleport.ts b/packages/compiler-ssr/src/transforms/ssrTransformTeleport.ts index 5a39688db24..d9cfdbb0274 100644 --- a/packages/compiler-ssr/src/transforms/ssrTransformTeleport.ts +++ b/packages/compiler-ssr/src/transforms/ssrTransformTeleport.ts @@ -19,7 +19,7 @@ export function ssrProcessTeleport( node: ComponentNode, context: SSRTransformContext ) { - const targetProp = findProp(node, 'target') + const targetProp = findProp(node, 'to') if (!targetProp) { context.onError( createSSRCompilerError(SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET, node.loc)