[英]Unknown plugin “transform-decorators-legacy” error when using react storybook in windows
I cloned a React project created on Linux to my Windows machine. 我将在Linux上创建的React项目克隆到我的Windows机器上。 The Project includes few react components and a storybook to test those components.
该项目包括一些反应组件和一个故事书来测试这些组件。 The "npm start" is configured to run the storybook at the "package.json" file:
“npm start”配置为在“package.json”文件中运行故事书:
"start": "npm run storybook" “开始”:“npm run storybook”
After typing "npm start" I got this error on the browser console: 键入“npm start”后,我在浏览器控制台上收到此错误:
"Uncaught Error: Module build failed: ReferenceError: Unknown plugin "transform-decorators-legacy" specified in 'C:\\...\\node_modules\\@storybo ok\\ui\\node_modules\\react-treebeard\\.babelrc'". “未捕获错误:模块构建失败:ReferenceError:未知插件”transform-decorators-legacy“在'C:\\ ... \\ node_modules \\ @storybo ok \\ ui \\ node_modules \\ react-treebeard \\ .babelrc'中指定”。 This is my webpack.config.js file (the problem probably comes from there):
这是我的webpack.config.js文件(问题可能来自那里):
module.exports = (baseConfig, env) => {
const config = genDefaultConfig(baseConfig, env);
config.module.rules.push({
use: {
loader: 'babel-loader',
options: {
presets: [
['env', {
modules: false
}],
'react',
'flow'
],
plugins: [
'transform-class-properties',
'transform-object-rest-spread',
'flow-react-proptypes'
]
}
}
});
return config;
};
The commands runs with no errors under linux/mac. 这些命令在linux / mac下运行时没有错误。 The issue only occurs with windows.
该问题仅发生在Windows上。
node v8.5.0 npm v5.4.2 node v8.5.0 npm v5.4.2
I am having the same issue. 我有同样的问题。 Most are saying to make sure you exclude node_modules in your loaders section that has babel in it.
大多数人都说要确保在你的加载器部分中排除了包含babel的node_modules。
exclude: /node_modules/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.