optimism
optimism copied to clipboard
feat(ci): Add esm exports to sdk
- Add tsup to build esm modules for packages sdk depends on.
- Update the package exports to include extension to reduce ambiguity
- In general the old build is unchnaged. Typescript generates the cjs exports as before we just more explicitly target the build outputs now
- We also build esm and include those imports. This maximizes compatibility with all build tools
- As a bonus this will fix source maps
We should add this to all packages
Failing check fails on develop
Other failing checks also fail on develop https://github.com/ethereum-optimism/optimism/pull/4848
🦋 Changeset detected
Latest commit: 935ffce7d97f5c0bc3582aff358dee6622617226
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 3 packages
Name | Type |
---|---|
@eth-optimism/sdk | Minor |
@eth-optimism/chain-mon | Patch |
@eth-optimism/message-relayer | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Perhaps we could merge this after https://github.com/ethereum-optimism/optimism/pull/4778?
@tynes agreed this one is trying to fix a P0 bug for gateway but I want to look really quick on monday to see if I can do this in a simpler so this pr has less urgency to land
SDK only exports cjs and something about how we formatted the package.json makes some build tools unable to recognize it.
Trying to understand better, what does 'something' refer to in this line, can you point me to it? I am trying to understand what prevent us from using the module as a cjs in the gateway, haven't we been using it in that way till now?.
Perhaps this PR try to address different things and we could perhaps takle first the fix that is blocking deployments on the gateway (P0) and then as a follow-up to address P1s like switching to a more modern build system, source maps ecc.
@tynes what you think?
Contracts needs to not bundle
(btw not testing locally until ci passes then I'm testing with gateway and doing some extra due dillegence. So it's expected this will fail a bunch more times
tsc still needs to emit for contracts is the next one
removed bundling we are now at the point where we are going to be ready to go soon most likely
@nickbalestra @tynes this change is additive not subtractive or changing. The old build still exists with no changes. The only difference is we are adding esm outputs
removing clean is actually a better fix to my contract bundling issue but going to keep both since the change to bundling derisks this pr a tad via making the old buildsystem unchanged instead of mostly unchanged
Trying to understand better, what does 'something' refer to in this line, can you point me to it?
@nickbalestra I can't I would have to debug to figure it out but debugging is unnecessary since just doing everything cannonical best practice way confirmed fixes the issue
I am trying to understand what prevent us from using the module as a cjs in the gateway, haven't we been using it in that way till now?.
Webpack config because create react app bloats webpack handles this issue well. A more complicated change to gateway would also be able to handle it well. Core pain we are feeling is the pain of thinking we were deployed when we weren't for many many weeks
Perhaps this PR try to address different things and we could perhaps takle first the fix that is blocking deployments on the gateway (P0) and then as a follow-up to address P1s like switching to a more modern build system, source maps ecc.
This has been my strategy from minute 1. What you are seeing here is the simplist lowest risk solution
Testing baseline what ci is passing/failing in this pr is here https://github.com/ethereum-optimism/optimism/pull/4848
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Don't close as stale we really need this so source maps work and debugging the SDK can be done without spending 10 minutes putting console logs into a compiled node_modules/@eth-optimism/sdk/dist/Foo.js
file
Also need this because a minority but still large chunk of users will need special build tooling to use all our packages.
Just wondering if you are planning on continuing this @roninjin10, would like to help get your code merged
Hey @roninjin10! This PR has merge conflicts. Please fix them before continuing review.
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Hey @roninjin10! This PR has merge conflicts. Please fix them before continuing review.
@tynes this has actually been ready to go in the entire time unless there are changes requested
Deploy Preview for opstack-docs canceled.
Name | Link |
---|---|
Latest commit | 935ffce7d97f5c0bc3582aff358dee6622617226 |
Latest deploy log | https://app.netlify.com/sites/opstack-docs/deploys/64208e7a4a0c9800086687da |
Keeping this in draft don't trust this until I manually test everything again plus a tsup config appears to have gone missing rebasing
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.
going to do this but to every package instead of just the ones gateway uses post bedrock