diff --git a/packages/compiler-ssr/__tests__/ssrElement.spec.ts b/packages/compiler-ssr/__tests__/ssrElement.spec.ts
index 1d3a2d53..796fd41f 100644
--- a/packages/compiler-ssr/__tests__/ssrElement.spec.ts
+++ b/packages/compiler-ssr/__tests__/ssrElement.spec.ts
@@ -71,6 +71,27 @@ describe('ssr: element', () => {
`)
})
+ test("multiple _ssrInterpolate at parent and child import dependency once", () => {
+ expect( compile(`
{{ hello }}
`).code)
+ .toMatchInlineSnapshot(`
+ "const { ssrRenderAttrs: _ssrRenderAttrs, ssrInterpolate: _ssrInterpolate } = require(\\"@vue/server-renderer\\")
+
+ return function ssrRender(_ctx, _push, _parent, _attrs) {
+ let _temp0
+
+ _push(\`\${
+ _ssrInterpolate(_ctx.hello)
+ }
\`)
+ }"
+ `);
+ });
+
test('should pass tag to custom elements w/ dynamic v-bind', () => {
expect(
compile(``, {
diff --git a/packages/compiler-ssr/src/ssrCodegenTransform.ts b/packages/compiler-ssr/src/ssrCodegenTransform.ts
index cebce743..7f53ee62 100644
--- a/packages/compiler-ssr/src/ssrCodegenTransform.ts
+++ b/packages/compiler-ssr/src/ssrCodegenTransform.ts
@@ -56,10 +56,11 @@ export function ssrCodegenTransform(ast: RootNode, options: CompilerOptions) {
// Finalize helpers.
// We need to separate helpers imported from 'vue' vs. '@vue/server-renderer'
- ast.ssrHelpers = [
+ ast.ssrHelpers = Array.from(new Set([
...ast.helpers.filter(h => h in ssrHelpers),
...context.helpers
- ]
+ ]))
+
ast.helpers = ast.helpers.filter(h => !(h in ssrHelpers))
}