Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build errors on @mui files #156

Closed
Harry-Chen opened this issue Mar 29, 2024 · 1 comment
Closed

Build errors on @mui files #156

Harry-Chen opened this issue Mar 29, 2024 · 1 comment

Comments

@Harry-Chen
Copy link
Owner

See vitejs/vite#15012. We have exactly the same symptoms when running vite.

@AsakuraMizu
Copy link
Collaborator

这个问题说起来还挺有意思的,我之前尝试移植到 preact 上的时候就有遇到这个 "use client" 报 warning 的问题,当时修了就没再研究

Learn-Helper/vite.config.ts

Lines 109 to 114 in 71ba2db

onwarn(warning, defaultHandler) {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE' && warning.message.includes('use client')) {
return;
}
defaultHandler(warning);
},

结果现在才知道居然是因为 @vitejs/plugin-react-swc 直接忽略了这个 warning,但是 @preact/preset-vite 没有忽略
https://github.com/vitejs/vite-plugin-react-swc/blob/b829b03f6476bed60ff5535fe883abc1b0b4e095/src/index.ts#L272-L280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants