s-l*_*ndz 8 babel node.js electron
我想在Electron项目中将我的Babel配置更新到版本7.
我添加了我需要的所有插件:
"devDependencies": {
"@babel/cli": "^7.0.0-beta.40",
"@babel/core": "^7.0.0-beta.40",
"@babel/node": "^7.0.0-beta.40",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.40",
"@babel/plugin-proposal-decorators": "^7.0.0-beta.40",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.40",
"@babel/plugin-proposal-optional-chaining": "^7.0.0-beta.40",
"@babel/plugin-transform-async-to-generator": "^7.0.0-beta.40",
"@babel/polyfill": "^7.0.0-beta.40",
"@babel/preset-env": "^7.0.0-beta.40",
"@babel/preset-react": "^7.0.0-beta.40",
"babel-eslint": "^7.1.1",
Run Code Online (Sandbox Code Playgroud)
编译是好的,但当Electron运行我的main.js(编译)时,我有这个错误:
A JavaScript error occurred in the main process
Uncaught Exception:
ReferenceError: regeneratorRuntime is not defined
我试着安装regeneratorRuntime模块,但没有结果.
Mic*_*ski 23
您应该在代码中导入Babel Polyfill:
import "@babel/polyfill";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11427 次 |
| 最近记录: |