Class compilation in TS when pluginBabel enabled not working as expected #2887
Unanswered
NikAtIdeally
asked this question in
Q&A
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Im currently moving away from CRA/CRACO and I found unexpected behaviour with my app.
I was able to reproduce the behaviour with a new empty react app creating using
create rsbuild
When adding
pluginBabel
to plugins indefineConfig
it yields unexpected bundled js code.Here is the TS code example that I have:
So when referencing an instance of this class from anywhere in the app I expect NUM to be === to this.int passed in constructor. And it works like this without the babel plugin. However when I add pluginBabel() to my plugins list it stops working.
Here is my rsbuild.config:
So here is the compiled JS code without the plugin:
and here is what I see when I enable the plugin:
So it looks like its trying to set NUM before constructor is called. Which leads the value to be undefined.
Output of

this
:So question is: Is this a me issue? Am I missing configuration or something?
Ive just tried Vite (and their hot reload did not work for me), and did not have issues with their babel plugin. 🤷♂️ Any advice would be great. not too keen on having to go back to CRA.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions