shinyoshiaki / werift-webrtc

WebRTC Implementation for TypeScript (Node.js), includes ICE/DTLS/SCTP/RTP/SRTP/WEBM/MP4
MIT License
463 stars 29 forks source link

move nonstandard into exports #360

Closed koush closed 7 months ago

koush commented 8 months ago

Building on previous change. https://github.com/shinyoshiaki/werift-webrtc/pull/359

The primary goal is to remove mp4box as an automatically included dependency, which is large, and also pulls in a significant portion of lodash.

import nonstandard from "werift/nonstandard";

This requires module resolution node 16 set in tsconfig when used by typescript. which shouldn't be a problem since this library requires node 16 anyways.

https://stackoverflow.com/a/72275458

koush commented 8 months ago

it's also possible to achieve different behavior (or preserve legacy behavior) by using different entry points for main vs exports.

koush commented 8 months ago

Another option would be to publish the nonstandard stuff in a totally different package, as @werift/nonstandard. This would eliminate the dependencies altogether at compile time, which may have scripts that run during install.

I think the current pull request is the least painful transition though.

shinyoshiaki commented 8 months ago

@koush I have created another PullRequest with improved writing of the exports field and would appreciate a review of that one.

361

koush commented 8 months ago

looks good to me