babel-preset-vue-app icon indicating copy to clipboard operation
babel-preset-vue-app copied to clipboard

Support browserslist

Open sobolevn opened this issue 7 years ago • 1 comments
trafficstars

babel-preset-env internally uses browserslist to get the actual browser versions.

But currently in babel-preset-vue-app we use { ie: 9, uglify: true } as default targets value. So, should we consider supporting browserslist?

sobolevn avatar Jun 10 '18 14:06 sobolevn

After tweaking some code for a while I came up with this idea.

babel-preset-env has this option: ignoreBrowserslistConfig. So, we can make use of it: when it is specified (default) we can fallback to { ie: 9, uglify: true }. But, when it is set to false - then we just pass undefined to the options here: https://github.com/vuejs/babel-preset-vue-app/blob/master/src/index.js#L21

Something like this:

[require('babel-preset-env').default, {
  useBuiltIns,
  targets: ignoreBrowserslistConfig ? targets : undefined,
  modules: false
}],

@egoist what do you think? I can create a PR if that's fine.

sobolevn avatar Sep 08 '18 08:09 sobolevn