feathers
feathers copied to clipboard
feat: ES module builds (ESM Support)
This pull request adds ES module builds to all package distributables. It is backwards compatible by still providing the CommonJS version as well but will use ES modules in applications with "type": "module" (like the generated app) and with client side bundlers so it can use features like tree shaking.
Closes https://github.com/feathersjs/feathers/issues/2748 Closes https://github.com/feathersjs/feathers/issues/2001
This looks like a good step, thank you. I am seeing the same error locally you can see in CI:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib' is not defined by "exports" in /home/runner/work/feathers/feathers/packages/transport-commons/node_modules/@feathersjs/errors/package.json
I'm not sure what that means since all those packages have an identical configuration.
Deploy Preview for feathers-dove canceled.
| Name | Link |
|---|---|
| Latest commit | 820743dac5fddeab1388f3459efd0b09b624f196 |
| Latest deploy log | https://app.netlify.com/sites/feathers-dove/deploys/63a1fa7fabc93400090a0d76 |
@daffl, @FossPrime
I don't know what the error in the generator is about:
Builds are passing. I think we could try it out.
I don't know what the best strategy is though. Install from github is not possible because of lerna workspace packages, right? Maybe we need pre-versions.
Making a note here that the thing that may be missing is that the ESM and CJS folders each need a package.json that declares the module type like
{ "type": "module|commonjs" }
Now that TypeScript seems to support it properly it might also make sense to use full imports with .js extensions.