更新时间:2023-09-27 23:54:04
经过数小时的挫折,我搬走了
After many hours of frustration, I moved
const SerialPort = require('serialport');
从应该由webpack捆绑到index.html的javascript文件中:
from javascript file which is supposed to be bundled by webpack to index.html:
<script>
const SerialPort = require('serialport');
</script>
<script src="dist/bundle.js"></script>
SerialPort现在可以识别了.
SerialPort is now recognized.
此外,似乎webpack-dev-server在Electron和serialport上不能很好地工作.我必须启动完整的电子应用程序.
Also, it seems like webpack-dev-server doesn't work very well with Electron and serialport. I have to launch full electron app.