Closed hung-phan closed 9 years ago
If you remove typecheck
from your .babelrc
and compile your code, everything will work as normal without the typechecks, but I agree this isn't very convenient. It comes down to the inability to pass options to babel plugins which should be changing soon
Another point though is that is the overhead real or imagined? The vast, overwhelming majority or apps can get away with leaving this on and it will make no discernible difference to performance at all.
Thanks @phpnode, maybe I overthink about it.
If you remove typecheck from your .babelrc and compile your code, everything will work as normal without the typechecks
What is removing the type annotations in this case?
Another point though is that is the overhead real or imagined? The vast, overwhelming majority or apps can get away with leaving this on and it will make no discernible difference to performance at all.
When you have several 1000 modules with type annotations, it will make a difference to bundle size. And it's questionable to be throwing those errors in production.
Oh, TIL Babel strips Flow types by default :)
it's questionable to be throwing those errors in production.
Well, at least with this enabled then you'll get an early error, so typically you can find the source of the bug faster. With typechecks disabled you'll either get an error further down the stack or unwanted behaviour and it'll be much harder to track down.
I have some questions regarding to have
babel-plugin-typecheck
running in production mode. Is there any way that I can cut off the overheads of type checking in production mode, which means the type check will be enable in development only. My current config for.babelrc
is:And my production config I include
new webpack.optimize.UglifyJsPlugin()
. However, I got the production code compiled to the following:Any idea on this? Also thanks for this wonderful plugin.