Question: why don't we set the target environment settings for `babel-preset-env` part?
revelt opened this issue · comments
I'm talking about babel
branch specifically.
Correct me if I'm wrong, but the point of babel-preset-env
is to automate the Babel settings, specifying only the target platform, like "targets": { "browsers": ["last 2 versions", "ie >= 7"] }
or "browsers": "> 5%"
and so on. The Babel then knows what level of transpiling is needed. Because maybe, for example, your internal corporate portal is ran by Chrome users only. Or, for example, you can't sort out IE flexbox bugs and block it completely.
For example, .babelrc
would have settings for babel-preset-env
:
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions"]
}
}]
]
}
Now, I see we set the Babel settings in rollup.config.js
:
UMD settings part:
{
entry: 'src/main.js',
dest: pkg.browser,
format: 'umd',
moduleName: 'howLongUntilLunch',
plugins: [
resolve(), // so Rollup can find `ms`
commonjs(), // so Rollup can convert `ms` to an ES module
babel({
exclude: ['node_modules/**']
})
]
}
My question: why does babel-preset-env
have no settings in UMD part for the target environment? Is it because we want to make the module the most universal and therefore we apply the maximum transpiling?
Hi Harsh, thanks for the link, it still does not answer my question though...
Why does babel-preset-env
have no settings (I'm talking about UMD part) for the target environment?
OK, I got what you're saying, it comes from .babelrc
in the root. OK.
Will close now. Thanks!