Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 35 commits into from

Conversation

radglob
Copy link
Contributor

@radglob radglob commented Jun 13, 2023

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
Copy link

changeset-bot bot commented Jun 13, 2023

🦋 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
Name Type
@primer/react Major

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
Copy link
Contributor

github-actions bot commented Jun 13, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 98.51 KB (+0.03% 🔺)
dist/browser.umd.js 99.08 KB (+0.04% 🔺)

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

@joshblack joshblack left a comment

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 👀

package.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
rollup.config.mjs Show resolved Hide resolved
@radglob radglob marked this pull request as ready for review June 20, 2023 13:28
@radglob radglob requested review from a team, colebemis and joshblack June 20, 2023 13:28
@github-actions github-actions bot 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-actions bot 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-actions bot temporarily deployed to storybook-preview-3410 June 20, 2023 15:56 Inactive
@joshblack
Copy link
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
Contributor Author

radglob commented Jun 20, 2023

@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-actions bot 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-actions bot 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-actions bot 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-actions bot 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-actions bot temporarily deployed to storybook-preview-3410 July 14, 2023 14:12 Inactive
@primer primer bot temporarily deployed to github-pages July 14, 2023 15:44 Inactive
@github-actions github-actions bot 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-actions bot 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-actions bot temporarily deployed to storybook-preview-3410 July 21, 2023 15:29 Inactive
@joshblack
Copy link
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 🤞

@joshblack joshblack closed this Jul 27, 2023
Sign up for free to 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