I don't get the difference b/w babel exclude vs ignore option even after reading their documentation.
What I understood is that exclude is less aggressive than ignore. And exclude makes the current configuration object inactive and ignore stops the processing all together.
Maybe if someone from babel team(or any expert on babel can put up nicely for the general public out here would be much appreciated.
What I understood is that exclude is less aggressive than ignore. And exclude makes the current configuration object inactive and ignore stops the processing all together.
That's essentially accurate.
When a file is ignoreed, Babel will skip processing it entirely, which makes it good for excluding files that aren't JS, or files that you explicitly know should not be processed, like large already-bundled files.
The exclude key skips applying a given configuration block to a given file. This is primarily useful alongside the overrides option, allowing you to do things like this:
presets: ["@babel/preset-env"],
overrides: [
{
exclude: /node_modules/,
plugins: ["babel-plugin-lodash"],
},
],
for instance, if you wanted to compile all of your files with preset-env, but only process your local application files with babel-plugin-lodash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With