From 011438d16dc42408d5229b842d67dba28868566b Mon Sep 17 00:00:00 2001 From: ygj6 Date: Fri, 23 Apr 2021 00:43:32 +0800 Subject: [PATCH] fix(plugin-vue): avoid duplicate import, fix #2640 (#2897) --- packages/plugin-vue/src/main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index 655d0db83e871b..cec1ac67f54f6e 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -143,10 +143,10 @@ export async function transformMain( // SSR module registration by wrapping user setup if (ssr) { output.push( - `import { useSSRContext } from 'vue'`, + `import { useSSRContext as __vite_useSSRContext } from 'vue'`, `const _sfc_setup = _sfc_main.setup`, `_sfc_main.setup = (props, ctx) => {`, - ` const ssrContext = useSSRContext()`, + ` const ssrContext = __vite_useSSRContext()`, ` ;(ssrContext.modules || (ssrContext.modules = new Set())).add(${JSON.stringify( filename )})`,