admin管理员组文章数量:1318564
I am somewhat new to Babel. I was successful when tried to transform some .jsx files in a directory using this mand:
babel --plugins transform-react-jsx test.js
But when I tried to transform a list of jsx files in a directory, it failed. Here is the mand and error message:
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 Objectpile (/usr/local/lib/node_modules/babel-cli/lib/babel/util.js:62:12)
I have no idea that why it turned out to be like this. Plugin babel-plugin-transform-react-jsx has been installed using mand:
npm install babel-plugin-transform-react-jsx
I am somewhat new to Babel. I was successful when tried to transform some .jsx files in a directory using this mand:
babel --plugins transform-react-jsx test.js
But when I tried to transform a list of jsx files in a directory, it failed. Here is the mand and error message:
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.pile (/usr/local/lib/node_modules/babel-cli/lib/babel/util.js:62:12)
I have no idea that why it turned out to be like this. Plugin babel-plugin-transform-react-jsx has been installed using mand:
npm install babel-plugin-transform-react-jsx
Share
Improve this question
edited Jan 12, 2016 at 20:31
loganfsmyth
162k31 gold badges346 silver badges258 bronze badges
asked Jan 7, 2016 at 2:58
user5755288user5755288
411 silver badge5 bronze badges
5
-
1
Where is the plugin installed? It needs to be in a parent
node_modules
relative totemp_realtime
so since you're using..
that seems unlikely. – loganfsmyth Commented Jan 7, 2016 at 3:09 -
It is installed where I called the mand,
./
. But I don't want to make the directorynode_modules
be in the same parent directory wheretemp_realtime
is in. – user5755288 Commented Jan 7, 2016 at 3:14 - Considering you are new to babel I would suggest to use it via Gulp so you don't have to hassle with all the mand line parameters this way. Check out Gulp and Gulp babel – E. Sundin Commented Jan 7, 2016 at 3:17
- Thanks for your remendation. I'll try it out : ) – user5755288 Commented Jan 7, 2016 at 6:09
- @E. Sundin, it doesn't work.. – user5755288 Commented Jan 7, 2016 at 6:56
1 Answer
Reset to default 8It happened to me because I was accidentally using:
{
"plugins": ["es2015", "react"]
}
when I actually meant:
{
"presets": ["es2015", "react"]
}
本文标签:
版权声明:本文标题:javascript - "ReferenceError Unknown plugin" when I try to transform js files in a directory using babel cli - 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742049187a2417972.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论