Skip to content Skip to sidebar Skip to footer

Babel 7 And Webpack 4 Not Working For Conditional Spread Operation In Array[short Circuit Syntax]

I am facing peculiar problem where short circuit syntax is not working after upgrading to Babel 7 from previous version where I was using stage-0 and it was working without any iss

Solution 1:

I'm assuming that isCSCProfile is boolean. If isCSCProfile is false, then you're trying to spread a boolean in the first case, which will not work.

After digging a bit more into this it seems I was wrong about spread syntax not working for booleans. @babel/plugin-transform-spread has option named loose, that should just skip "nullish" values, which is what you want here. There's also an open issue about loose mode consistency, which is very likely the reason this doesn't work right.

Post a Comment for "Babel 7 And Webpack 4 Not Working For Conditional Spread Operation In Array[short Circuit Syntax]"