Most of my classes are compiling to: var whateverClassName=Null #19583
fracturedexistence
started this conversation in
General
Replies: 1 comment
-
Please create reproducible test repo and I will look |
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.
-
Hi, I recently upgraded Babel to version 7, and the docs recommended Webpack as a companion package.
So, yes... I'm new to WebPack, be gentle on me.
But my problem is... I cannot get my classes to transpile properly.
Here's a simple test file that I created, (because this was driving me bonkers):
The resulting file (minus all of Babel's polyfill) is:
var LongClassNameA=null,LongClassNameB=null
This is an unacceptable outcome.
I've tried a myriad of configuration changes to my webpack.config.js file
involving optimization.sideEffects, and minimization & TerserPlugin options, none of my changes made any difference at all.
However, I did find one workaround solution, it seems silly that I have to do this, but it works 100% of the time.
Now transpiles to (minus all of Babel's polyfill)
var LongClassNameA=_createClass((function LongClassNameA(){_classCallCheck(this,LongClassNameA),_defineProperty(this,"prop",void 0),this.prop="XYZ",console.log("[A] A Superclass Instantiated")})),LongClassNameB=function(){function LongClassNameB(){var t;return _classCallCheck(this,LongClassNameB),t=_callSuper(this,LongClassNameB),console.log("[B] B Subclass Instantiated"),t}return _inherits(LongClassNameB,LongClassNameA),_createClass(LongClassNameB,null,[{key:"wpbug",value:function wpbug(){}}])}();LongClassNameB.wpbug();
So, if anyone else is experiencing this annoyance, feel free to use my workaround to bring some sanity back into your work life.
If any one knows of a webpack configuration that will definitely prevent my classes from transpiling to
<classname>=null
, then please share your valuable knowledge! It would be very appreciated!I'm guessing this might be a bug, but I'm not going to wait months for a patch to drop.
Cheers
Beta Was this translation helpful? Give feedback.
All reactions