vuejs / vue-class-component

ES / TypeScript decorator for class-style Vue components.
MIT License
5.81k stars 429 forks source link

[BUG] Duplicate export of 'default' #540

Closed NWYLZW closed 2 years ago

NWYLZW commented 3 years ago

desc

get a error when use vue-class-component and vite

logs

image

versions

vite - 2.3.5 vue-class-component - 8.0.0-rc.1

ygj6 commented 3 years ago

Duplicate of https://github.com/vitejs/vite/issues/3693 ?

NWYLZW commented 3 years ago

Duplicate of vitejs/vite#3693 ?

If it is fixed, I will try again

GongT commented 3 years ago

代码里看到已经修复了,但是npm上最新版是@vue/compiler-sfc 3.1.1,还没更新。

可以先把node_modules/@vue/compiler-sfc/dist/里面compiler-sfc.cjs.jscompiler-sfc.esm-browser.js两个文件改一下。

const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)as(\s*)default/s;
//                                                                    ^--- 这加个s
NWYLZW commented 3 years ago

代码里看到已经修复了,但是npm上最新版是@vue/compiler-sfc 3.1.1,还没更新。

可以先把node_modules/@vue/compiler-sfc/dist/里面compiler-sfc.cjs.jscompiler-sfc.esm-browser.js两个文件改一下。

const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)as(\s*)default/s;
//                                                                    ^--- 这加个s

hhhh thx ^-^