-
Notifications
You must be signed in to change notification settings - Fork 30
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
引入react的cdn会报如下错误 #17
Comments
+1 |
1 similar comment
+1 |
应该是使用了最新的tsconfig配置造成的,把打包里的import语句去掉就可以了,本质还是依赖的rollup-plugin-external-globals没有解决eight04/rollup-plugin-external-globals#26 |
别完全拷贝例子啊,去掉lazy试试,index.html需要引入react reactdom cdn 链接
发自我的iPhone
…------------------ 原始邮件 ------------------
发件人: chrisworkalx ***@***.***>
发送时间: 2022年7月1日 19:42
收件人: MMF-FE/vite-plugin-cdn-import ***@***.***>
抄送: cixing ***@***.***>, Comment ***@***.***>
主题: Re: [MMF-FE/vite-plugin-cdn-import] 引入react的cdn会报如下错误 (Issue #17)
|
我去,有用! |
我用了这个插件 vite-plugin-external解决了上述问题。 import createExternal from 'vite-plugin-external';
// ...
plugins: [
createExternal({
interop: 'auto', // 这个声明很重要
externals: {
react: 'React',
'react-dom': 'ReactDOM',
}
})
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: