I'm trying to configure web with optimize-plugin and babel to create module/nomodule bundles. In fact, I son't mind too much the nomodule thing, but I'd like to be sure to correctly configure babel to output es2017 code. In several tuts, for example this one, I've found a preset like 'es2017', but from babel docs it seems it's not supported anymore. Instead, I should use '@babel/preset-env' along with a browserlist config. It's not really clear to me how I should compose the browserlist. For now, I would say something like:
module.exports = {
presets : [ '@babel/preset-env' ],
targets : {
browsers: "last 2 versions, not dead, not IE 11",
esmodules: true
}
};
But not really sure.. Can someone tell me the perfect one? :)
I've just found an answer by reading this code that comes from here. It's simply:
'last 2 Chrome versions',
'last 2 Safari versions',
'last 2 iOS versions',
'last 2 Edge versions',
'Firefox ESR',
And not using the esmodules target due to this issue, as reported in comments on linked code above:
https://github.com/babel/babel/issues/8809
Even if probably with babel 8 we will be able to use it: