Skip to content

Convert @primer/react to ESM, don't generate CommonJS bundle. - #3410

Closed
radglob wants to merge 35 commits into
next-majorfrom
convert-to-esm
Closed

Convert @primer/react to ESM, don't generate CommonJS bundle.#3410
radglob wants to merge 35 commits into
next-majorfrom
convert-to-esm

Conversation

@radglob

@radglobradglob commented Jun 13, 2023

Copy link
Copy Markdown
Contributor

Changed some configuration files to use .cjs extension, others to use .mjs extension, and remove settings to produce CommonJS bundle.

There are likely a lot more changes we could make (ex. only using import instead of require in some places) but this seems to produce an ESM bundle and continues to work correctly in a toy project.

Closes#2108.

Screenshots

Please provide before/after screenshots for any visual changes

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@changeset-bot

changeset-botBot commented Jun 13, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4b752b0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@primer/reactMajor

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

@github-actions

github-actionsBot commented Jun 13, 2023

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
dist/browser.esm.js98.51 KB (+0.03% 🔺)
dist/browser.umd.js99.08 KB (+0.04% 🔺)

@radglob
radglob temporarily deployed to github-pages June 13, 2023 17:30 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 June 13, 2023 17:30 Inactive

@joshblackjoshblack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Just left a comment for the package.json file itself 👀

Comment threadpackage.json
Comment threadpackage.json
Comment threadrollup.config.mjs
@radglob
radglob marked this pull request as ready for review June 20, 2023 13:28
@radglob
radglob requested review from a team, colebemis and joshblackJune 20, 2023 13:28
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 June 20, 2023 13:32 Inactive
@radglob
radglob temporarily deployed to github-pages June 20, 2023 13:32 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 June 20, 2023 13:33 Inactive
@radglob
radglob temporarily deployed to github-pages June 20, 2023 15:55 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 June 20, 2023 15:56 Inactive
@joshblack

Copy link
Copy Markdown
Member

@radglob just wanted to double check, I'm still not seeing "type": "module" in package.json and was curious if it's on my end or if it still needs to be added 👀

@radglob

Copy link
Copy Markdown
ContributorAuthor

@radglob just wanted to double check, I'm still not seeing "type": "module" in package.json and was curious if it's on my end or if it still needs to be added 👀

Yeah, that was a mistake on my part. I think I got distracted changing up the exports.

@radglob
radglob temporarily deployed to github-pages June 20, 2023 17:36 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 June 20, 2023 17:36 Inactive
@radglob
radglob temporarily deployed to github-pages July 13, 2023 18:47 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 July 13, 2023 18:48 Inactive
@radglob
radglob temporarily deployed to github-pages July 13, 2023 18:55 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 July 13, 2023 18:56 Inactive
@radglob
radglob temporarily deployed to github-pages July 13, 2023 19:23 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 July 13, 2023 19:23 Inactive
@radglob
radglob temporarily deployed to github-pages July 14, 2023 14:12 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 July 14, 2023 14:12 Inactive
@radglobradglob added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jul 14, 2023
@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jul 14, 2023
@primer
primerBot temporarily deployed to github-pages July 14, 2023 15:44 Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 July 14, 2023 15:44 Inactive
@radglob
radglob temporarily deployed to github-pages July 20, 2023 13:50 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 July 20, 2023 13:51 Inactive
@radglob
radglob temporarily deployed to github-pages July 21, 2023 15:29 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3410 July 21, 2023 15:29 Inactive
@joshblack

Copy link
Copy Markdown
Member

Closing this out due to the technical limitations mentioned in: #3565 😞 Will make sure to use this as the base for any follow-up ESM work 🤞

@jonrohan
jonrohan deleted the convert-to-esm branch May 9, 2025 18:35
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@radglob@joshblack