通过gulp-babel
为服务器进行转换,并通过browserify
为客户端使用babelify
进行转换 - 在我的代码中使用async和await。这些功能似乎转变得很好,但是......
错误:找不到模块“babel-runtime/helpers/typeof”
.babelrc
的内容
{
"presets": ["react", "es2015"],
"plugins": [
"transform-class-properties",
"transform-async-to-generator",
"transform-runtime"
]
}
package.json
相关内容
"babel-core": "6.3.13",
"babel-eslint": "4.1.6",
"babel-plugin-transform-async-to-generator": "6.3.13",
"babel-plugin-transform-class-properties": "6.3.13",
"babel-plugin-transform-runtime": "6.3.13",
"babel-preset-es2015": "6.3.13",
"babel-preset-react": "6.3.13",
"babelify": "7.2.0",
"browserify": "12.0.1",
"gulp-babel": "6.1.0",
我还发现了其他一些对此的提及,其中许多似乎都指向这里 - https://github.com/babel/babel/issues/2954
但是我在上面的链接中收到了 404 错误,并且确实看不到与 babel
相关的任何问题 - https://github.com/babel/babel/issues重定向至https://github.com/babel/babel/pulls
有什么想法吗?
最佳答案
结果我需要安装 babel-runtime
,我认为随着 Babel v6 的发布,它已经被弃用了。
关于transform - 巴别塔 - 错误 : Cannot find module 'babel-runtime/helpers/typeof' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34321587/