feat: esm
Closes #2981
I kept this PR as minimal as I could. It introduces esbuild to be able to compile ESM to CJS to support both:
- I had to migrate `lib` to ESM because esbuild doesn't support transforming `require()` into `import`
- I had to write a little esbuild plugin to transform TLAs into `require()`
Things left to do where I'll need some help:
- I added a build script for esm/cjs but I'm not sure how it relates to `install/build.js`
- I'm not sure how tests are currently setup so unsure how to properly test esm/cjs
- I left some `require()` calls in `libvips.js` because they only seem consumed by `binding.gyp`
合并状态:未合并 5 条评论