serialport / bindings-cpp

The C++ bindings for the node serialport project.
MIT License
21 stars 40 forks source link

feat: build and ship ESM js files too #88

Closed MarshallOfSound closed 1 year ago

MarshallOfSound commented 1 year ago

This adds a simple second tsconfig that has module: ES2022 and the required module field in the package.json so that bundlers like webpack can find it.

This is required in order for this package to work with @vercel/webpack-asset-relocator-loader which is a pre-requisite to using this module in certain webpack deployment environments (electron, single-package-executables, etc.)

I specifically chose to ship dist-esm instead of dist/cjs and dist/esm to avoid path resolution changes 🤷

Refs: https://github.com/electron/forge/issues/2949 Refs: https://github.com/vercel/webpack-asset-relocator-loader/pull/168

reconbot commented 1 year ago

Should we be using the standardized exports field instead?

I specifically chose to ship dist-esm instead of dist/cjs and dist/esm to avoid path resolution changes 🤷

I wouldn't worry about it.