You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, I wanted to thank you for all the work that has been made here. We have been using CRA for a long time now and we are happy with it.
I would try to explain our situation to discover if this is a real bug or it's simply a bad use of the babel-preset-react-app. I have made two sandboxes for you. Hope it helps!
We were using babel-preset-react-app in our Babel configuration to transpile our React components library. We needed to transpile it to ESModules to enable our CRA-made applications to build with the tree-shaking switch on. That's was working until we upgraded to CRA 4, that's where babel-preset-react-app came out not transpiling our files anymore to ESModules.
Here are the sandboxes where the only differences are the package.json dependencies:
To try these sandboxes, you will have to fork them, after that, you could be able to open a terminal there and run this command npm run build. As you can see, the build script inside package.json is calling babel-cli to build our /src folder into /build.
As you will see in the first sandbox(10.x), the files inside /build are in CommonJs but in the second one(9.x), the files are in ESModules. Is this a bug?
We did some digging before posting this issue, we found this interesting MR where we found some light. As I can see this is a bugfix MR. So, we were relying on a bug to transpile our code into ESModules?. We did understand that the optional property useESModules in babel-preset-react-app was made for this.
Probably we were wrong on that. We know we can achieve this without using babel-preset-react-app but we were happily using it because we thought that as with CRA(react-scripts) we would benefit from further updates and features that would come from this project.
Did you try recovering your dependencies?
Yes
Environment
Node 12 with the above-listed dependencies.
Steps to reproduce
Open one of the sandboxes:
Fork the sandbox
Open a new terminal (right side of the screen, it is a '+' icon)
run npm run build on the terminal
Check /build files.
Expected behavior
We were expecting the first sandbox to transpile the code into ESModules as well as the second one.
Actual behavior
It is transpiling the code into CommonJS
Reproducible demo
The sandboxes above.
The text was updated successfully, but these errors were encountered:
Describe the bug
Hello everyone,
First of all, I wanted to thank you for all the work that has been made here. We have been using CRA for a long time now and we are happy with it.
I would try to explain our situation to discover if this is a real bug or it's simply a bad use of the
babel-preset-react-app
. I have made two sandboxes for you. Hope it helps!We were using
babel-preset-react-app
in our Babel configuration to transpile our React components library. We needed to transpile it to ESModules to enable our CRA-made applications to build with the tree-shaking switch on. That's was working until we upgraded to CRA 4, that's wherebabel-preset-react-app
came out not transpiling our files anymore to ESModules.Here are the sandboxes where the only differences are the package.json dependencies:
To try these sandboxes, you will have to fork them, after that, you could be able to open a terminal there and run this command
npm run build
. As you can see, the build script insidepackage.json
is callingbabel-cli
to build our/src
folder into/build
.As you will see in the first sandbox(10.x), the files inside
/build
are in CommonJs but in the second one(9.x), the files are in ESModules. Is this a bug?We did some digging before posting this issue, we found this interesting MR where we found some light. As I can see this is a bugfix MR. So, we were relying on a bug to transpile our code into ESModules?. We did understand that the optional property
useESModules
inbabel-preset-react-app
was made for this.Probably we were wrong on that. We know we can achieve this without using
babel-preset-react-app
but we were happily using it because we thought that as with CRA(react-scripts) we would benefit from further updates and features that would come from this project.Did you try recovering your dependencies?
Yes
Environment
Node 12 with the above-listed dependencies.
Steps to reproduce
Open one of the sandboxes:
npm run build
on the terminal/build
files.Expected behavior
We were expecting the first sandbox to transpile the code into ESModules as well as the second one.
Actual behavior
It is transpiling the code into CommonJS
Reproducible demo
The sandboxes above.
The text was updated successfully, but these errors were encountered: