electron-config导致webpack打包后运行程序报错的解决方案

来源:互联网 发布:多传感器数据融合 编辑:程序博客网 时间:2024/06/07 13:07

在electron程序中,引用了electron-config组件,使用webpack打包未报错,但运行时报错"Uncaught Exception:TypeError:Cannot read property 'filename' of underfined",经折腾后解决。

解决方案:在webpack.config.js中添加

externals: [{    'electron-config': 'require("electron-config")'  }]
由于本人也是刚刚接触,并不知道原因,也不太清楚加这条语句的作用,总之是加完后就可以正常运行程序了。

参考来自:https://github.com/sindresorhus/electron-config/issues/3

看回答区应该还有其他解决方案,本人未尝试。

0 0
原创粉丝点击