Skip to content

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

Closed
@FyiurAmron

Description

@FyiurAmron

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])
  })
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions