【发布时间】:2019-06-20 22:19:22
【问题描述】:
我试图将我的 react 项目转换为电子应用程序。作为
该项目是通过 webpack 捆绑的,我开始使用 electron-webpack
构建。运行 electron-webpack dev 时,/main 和 /renderer 都无法正确编译。
控制台日志抛出装饰器插件错误
The decorators plugin requires a 'decoratorsBeforeExport' option,
whose value must be a boolean. If you want to use the
legacy decorators semantics, you can set the 'legacy: true' option
Sooo,为什么不遵循这个明智的建议呢?然后,我更新了所有依赖项并更新了我的 .babelrc 文件,以添加 decoratorsBeforeExport 和 legacy 选项(false 和 分别为真)
"plugins": [
["@babel/plugin-proposal-decorators", {
"decoratorsBeforeExport": false,
"legacy": true,
}],
由于此后仍然显示错误,我从 _/node_modules_ 打开 plugin-proposal-decorators文件夹并为 options 添加了一个日志。显然,它没有识别我的选项集。我试过了
直接从 webpack 加载器配置,但问题仍然存在。
我的环境
- 节点:v11.2.0
- Webpack:v4.29.0
- @babel/core: v7.0.0
【问题讨论】:
标签: javascript webpack electron babeljs