feat: Add ESM support while maintaining CJS support#561
Conversation
VS code files **/dist package-lock.json
Also ran npm dedup to fix issue with @polkadot/types-codec
Helps maintaining minimal node version when working
24a6956 to
901f212
Compare
Explicity add `reflect-metadata` as the peer dependency was not being installed
901f212 to
836ba34
Compare
|
Two questions from my side:
|
TarikGul
left a comment
There was a problem hiding this comment.
LGTM, 1 question - I couldn't find where the new reflect-metadata package was being used?
|
I will keep as is for now then.
It is being used in the edit: I fixed the dev dependencies in this PR |
|
why follow up can just make the change now. also latest node lts is 22 not 18 and generally corepack is preferred over nvmrc |
Effectively to keep changes minimal.
Corepack is a little different as it relates to the package managers while |
ryanleecode
left a comment
There was a problem hiding this comment.
i think better to use tshy because currently tsup isnt doing any code splitting and the package isnt tree shakable. i've added some updates in this PR that is against the current PR.
i've also validated the bundle on https://arethetypeswrong.github.io/
That works for me. Left my full thought on the PR before merging it into this one, but it seems fine and I lack any strong enough opinion between the different tooling here. Thanks again for the help |
…ode (#581) Adding CI job to verify that all examples run as expected and are valid. Currently broken examples are added to an exception list and will be fixed later, but at a minimum, the working examples should not be breaking. Since adding ESM + CJS support in #561 we can move away from a separate build stage for only the examples. Since the examples will be mostly read, or run as one-off, we can point to building and running with `tsx` which simplifies the whole process.
Use
tsupto support both ESM and CJS.This is effectively replacing #455 which has gone stale.
No logic or tests have been touched.
Motivation
Add both ESM and CJS support in an attempt to modernize the library and open up to more users.
Key Changes
buildscript is nowtsup src/index.ts --format esm,cjs --dtsrm -rfwithrimraf(dev dep) which is more cross platformreflect-metadataas a dev dep in order for e2e tests to pass.nvmrcfile to use the same node version that CI is usingMain files to review
package.jsontsconfig.json