我正在尝试将使用构建的电子应用程序转换create-react-app为ViteJS. 到目前为止,我已经解决了很多问题,但我的一个依赖项出现了问题。
出于性能原因,我的项目使用了 golang 内置的内部库,并且该库是从电子应用程序的主进程中调用的。但是,运行时出现以下错误vite build。
[commonjs--resolver] Unexpected character '\xef\xbf\xbd' (Note that you need plugins to import files that are not JavaScript)\nRun Code Online (Sandbox Code Playgroud)\n以下行会发生这种情况
\nmodule.exports = require('./build/Release/goapi.node');\nRun Code Online (Sandbox Code Playgroud)\ngoapi.node是编译好的库。该库是使用 node-gyp 编译的,我 100% 确定编译是正确的,因为它正在使用使用 create-react-app 的当前设置。
有没有插件可以添加vite来支持导入本机模块?如果没有,我该如何解决这个问题?