Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build crashes on polyfills not present in built-ins.json #3578

Closed
FyiurAmron opened this issue Mar 5, 2019 · 0 comments · Fixed by #5543
Closed

build crashes on polyfills not present in built-ins.json #3578

FyiurAmron opened this issue Mar 5, 2019 · 0 comments · Fixed by #5543

Comments

@FyiurAmron
Copy link

FyiurAmron commented Mar 5, 2019

Version

3.4.1

Steps to reproduce

babel.config.js

module.exports = {
  presets: [
    [
      '@vue/app',
      {
        polyfills: [
          'es6.promise',
          'es6.symbol',
          'es7.array',
        ]
      }
    ]
  ],
};

What is expected?

build should run, or at least produce a reasonable error message

What is actually happening?

build crashes with "cannot read property 'android' of undefined"


can be "fixed" by e.g.

function getPolyfills (targets, includes, { ignoreBrowserslistConfig, configPath }) {
  const { isPluginRequired } = require('@babel/preset-env')
  const builtInsList = require('@babel/preset-env/data/built-ins.json')
  const getTargets = require('@babel/preset-env/lib/targets-parser').default
  const builtInTargets = getTargets(targets, {
    ignoreBrowserslistConfig,
    configPath
  })

  return includes.filter(item => {
    return ( builtInsList[item] === undefined )
      ? false
      : isPluginRequired(builtInTargets, builtInsList[item])
  })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants