"ReferenceError未知插件“;当我尝试使用babel-cli转换目录中的js文件时
"ReferenceError Unknown plugin" when I try to transform js files in a directory using babel cli
我对巴贝尔有些陌生。当我尝试使用以下命令转换目录中的一些.jsx文件时,我成功了:
babel --plugins transform-react-jsx test.js
但是,当我尝试转换目录中的jsx文件列表时,它失败了。以下是命令和错误消息:
babel --plugins transform-react-jsx ../public/js/bundle/temp_realtime/ -d ../public/js/bundle/realtime
ReferenceError: Unknown plugin "transform-react-jsx" specified in "base" at 0, attempted to resolve relative to "../public/js/bundle/temp_realtime"
at /usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:193:17
at Array.map (native)
at Function.normalisePlugins (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:173:20)
at OptionManager.mergeOptions (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:271:36)
at OptionManager.init (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:416:10)
at File.initOptions (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:191:75)
at new File (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:122:22)
at Pipeline.transform (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
at transform (/usr/local/lib/node_modules/babel-cli/lib/babel/util.js:53:22)
at Object.compile (/usr/local/lib/node_modules/babel-cli/lib/babel/util.js:62:12)
我不知道为什么会变成这样。插件babel-Plugin-transform-react-jsx已经使用命令安装:
npm install babel-plugin-transform-react-jsx
这件事发生在我身上是因为我不小心使用了:
{
"plugins": ["es2015", "react"]
}
我的意思是:
{
"presets": ["es2015", "react"]
}
相关文章:
- 转换成ES 5使用babel通过吞咽手表不工作
- 使用 Babel 将 ES6 模块转换为 ES5 AMD 模块,无法按预期工作
- 为什么babel将async/await转换为再生器
- Babel React 转换:属性值预期的字符串类型,但得到空
- 使用 babel 将 es6 转换为 es5,然后与 Browserify 捆绑
- 使用 Babel CLI 提取器提取 Javascript 获取文本消息
- 开始使用 babel-cli
- 如何阻止 babel 将“this”转换为“undefined”(并插入“use strict”)
- Gulp babel es2015 转换非常缓慢
- 在 Babel 中转换插件与语法插件
- "ReferenceError未知插件“;当我尝试使用babel-cli转换目录中的js文件时
- Array.prototype.values()未定义-使用Babel在NodeJS环境中转换ES6
- 可以't安装babel cli
- Babel:CLI已被移到包“Babel-CLI”中
- 如何使用 Babel 进行 CLI 程序
- Babel 6 CLI:意外的令牌导出
- Babel-cli类属性不能在阶段2中工作
- React-tools:当我使用Browserify和Babelify时,需要Babel-CLI吗?
- Babel cli不会为浏览器生成JS
- 为什么我得到一个“未知选项:.babelrc.”当尝试使用babel-cli v6编译我的代码时,预设错误