javascript 网络包巴别塔 6
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33608772/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Webpack Babel 6
提问by Seneca
When I try to compile my javascript with webpack & babel-loader, I get: (Babel version 6+)
当我尝试使用 webpack 和 babel-loader 编译我的 javascript 时,我得到:(Babel 版本 6+)
Hash: f6a14faa8862d530512e
Version: webpack 1.12.3
Time: 96ms
Asset Size Chunks Chunk Names
backend.js 1.75 kB 0 [emitted] main
backend.js.map 1.43 kB 0 [emitted] main
chunk {0} backend.js, backend.js.map (main) 28 bytes [rendered]
[0] multi main 28 bytes {0} [built] [1 error]
ERROR in The node API for `babel` has been moved to `babel-core`.
@ multi main
Patched!
How do I move the node API for babel
to babel-core
?
如何将节点 API 移动babel
到babel-core
?
回答by Seneca
npm uninstall babel --save-dev
This fixed it. Babel package is deprecated...
这修复了它。Babel 包已弃用...
回答by Warren Zhou
npm install babel-loader --save-dev
回答by Thi?n Tr?n H?u
Change loader: "babel",
=> loader: "babel-loader",
in webpack config
在 webpack 配置中更改loader: "babel",
=>loader: "babel-loader",
Hope this help! it's work for me
希望这有帮助!这对我有用
回答by Deepan Prabhu Babu
I did both these commands, then it started working !!
我做了这两个命令,然后它开始工作了!!
npm uninstall babel --save-dev
npm install babel-loader --save-dev
回答by hunter2009
I think it should be used like this:
我认为它应该像这样使用:
var babel = require('babel-core');
babel.transform(code, babelOptions);