Skip to content

no-serial-port actually requires serialport #589

@IlCallo

Description

@IlCallo

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);

node-modbus-serial/index.js

Lines 1256 to 1258 in 94c1a3e

try {
module.exports.RTUBufferedPort = require("./ports/rtubufferedport");
} catch (err) { }

node-modbus-serial/index.js

Lines 1264 to 1265 in 94c1a3e

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions