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

fix: explicit esm and cjs build via tsc, remove babel #59

Merged
merged 4 commits into from
May 8, 2024

Conversation

phanshiyu
Copy link
Contributor

@phanshiyu phanshiyu commented May 6, 2024

Why

Webpack in CRA cannot process cjs (see facebook/create-react-app#12700). Axios is serving cjs in current versions now because of:

      "browser": {
        "require": "./dist/browser/axios.cjs", // used to be: index.js in 1.1.2 which is esm, hence it worked
        "default": "./index.js"
      },

@zixiang2018 good find!

What

Goal: We serve CRA the esm version of our code instead of cjs

  1. Build ejs and cjs
  2. Configure package.json to allow target platforms to find them

Since in CRA es syntax is being used, importing dnsprove shd get it the esm version of our code, which also imports axios as opposed to require.

@zixiang2018 zixiang2018 mentioned this pull request May 6, 2024
@phanshiyu phanshiyu force-pushed the fix/build-explict-esm-and-cjs branch from 7b81804 to 7b12d8f Compare May 7, 2024 03:49
@phanshiyu phanshiyu marked this pull request as ready for review May 7, 2024 03:49
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@zixiang2018 zixiang2018 merged commit 6294609 into master May 8, 2024
5 checks passed
@zixiang2018 zixiang2018 deleted the fix/build-explict-esm-and-cjs branch May 8, 2024 08:29
Copy link

github-actions bot commented May 8, 2024

🎉 This PR is included in version 2.7.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants