Closed Harry-Chen closed 4 months ago
这个问题说起来还挺有意思的,我之前尝试移植到 preact 上的时候就有遇到这个 "use client"
报 warning 的问题,当时修了就没再研究
https://github.com/Harry-Chen/Learn-Helper/blob/71ba2db6dbb0923c7e346b1b3eab6f0bbdaf6825/vite.config.ts#L109-L114
结果现在才知道居然是因为 @vitejs/plugin-react-swc
直接忽略了这个 warning,但是 @preact/preset-vite
没有忽略
https://github.com/vitejs/vite-plugin-react-swc/blob/b829b03f6476bed60ff5535fe883abc1b0b4e095/src/index.ts#L272-L280
See https://github.com/vitejs/vite/issues/15012. We have exactly the same symptoms when running
vite
.