我正在使用 babel 7。
在他们的文档中,他们提到插件的新命名是带有 @babel/
前缀。
React-hot-loader babrlrc 配置推荐是:
{
"plugins": ["react-hot-loader/babel"]
}
我的 .babelrc 配置是:
{
"presets": ["@babel/env", "@babel/react"],
"env": {
"development": {
"plugins": ["@babel/react-hot-loader"]
},
"production": {}
}
}
假设@babel/react-hot-loader
是正确的定义是否正确?
我找不到更多有关它的文档。
最佳答案
说 @babel/react-hot-loader
会让 babel
在自身内部查找名为 react-hot-loader
的插件。据我所知,您尝试使用的包/插件不是由 babel 本身维护/拥有的。因此 @babel/react-hot-loader
将不起作用。您应该根据您尝试使用的插件的文档配置您的 .babelrc
。
我认为这是您在问题中提到的插件:react-hot-loader
按照以下设置说明进行操作:react-hot-loader/getting-started
关于javascript - 找不到 .babel 和 React-hot-loader 的正确配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51732363/