[英]Could not find/install babel plugin 'proposal-decorators' on CodeSandbox with Firebase
I'm trying to use Codesandbox in React project, but I'm stuck with error: Could not find/install babel plugin 'proposal-decorators': Cannot find plugin 'proposal-decorators' or 'babel-plugin-proposal-decorators'.我正在尝试在 React 项目中使用 Codesandbox,但我遇到了错误:无法找到/安装 babel 插件 'proposal-decorators':找不到插件 'proposal-decorators' 或 'babel-plugin-proposal-decorators' . Error happens when I adding firebase utility in the project.在项目中添加 firebase 实用程序时发生错误。 On my local machine everythings fine.在我的本地机器上一切都很好。 Here is my code: https://codesandbox.io/s/eloquent-sun-r1bcqv这是我的代码: https://codesandbox.io/s/eloquent-sun-r1bcqv
I tried to:我尝试过了:
"@babel/plugin-proposal-decorators": "7.18.2"
in dependencies of package.json安装 babel/plugin-proposal-decorators 并在 package.json 的依赖项中添加"@babel/plugin-proposal-decorators": "7.18.2"
"babel": "6.23.0"
in dependencies of package.json安装 babel 并在 package.json 的依赖项中添加"babel": "6.23.0"
{"plugins": ["@babel/plugin-proposal-decorators"]}
into that config创建 babel.confing.json 文件并将{"plugins": ["@babel/plugin-proposal-decorators"]}
添加到该配置中What cause the problem?什么原因导致问题? Why there is babel/plugin-proposal-decorators if I didn't add it?如果我没有添加,为什么会有 babel/plugin-proposal-decorators?
It's because of importing SVG as a ReactComponent.这是因为将 SVG 作为 ReactComponent 导入。 It can't be done in sandboxes.它不能在沙盒中完成。
Actually, I solved that problem by decreasing the version of实际上,我通过降低版本解决了这个问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.