I'm trying to use latest 8.0.20-no-serial-port version in an ESM project
It does indeed require serialport in multiple occasions, making the whole package less portable (I'm bundling a Node app with Bun compilation)
These are the lines that force a dependency on serialport:
|
const { SerialPort } = require("serialport"); |
|
require("./apis/connection")(ModbusRTU); |
|
try { |
|
module.exports.RTUBufferedPort = require("./ports/rtubufferedport"); |
|
} catch (err) { } |
|
module.exports.ServerTCP = require("./servers/servertcp"); |
|
module.exports.ServerSerial = require("./servers/serverserial"); |
Dunno if something changed recently or the package just isn't optimized to be executed within ESM projects
I'm trying to use latest
8.0.20-no-serial-portversion in an ESM projectIt does indeed require
serialportin multiple occasions, making the whole package less portable (I'm bundling a Node app with Bun compilation)These are the lines that force a dependency on
serialport:node-modbus-serial/index.js
Line 21 in 94c1a3e
node-modbus-serial/index.js
Line 1240 in 94c1a3e
node-modbus-serial/index.js
Lines 1256 to 1258 in 94c1a3e
node-modbus-serial/index.js
Lines 1264 to 1265 in 94c1a3e
Dunno if something changed recently or the package just isn't optimized to be executed within ESM projects