vuejs/vue-cli · error · Error

Cannot find polyfill ${item}, please refer to 'core-js-compa

Error message

Cannot find polyfill ${item}, please refer to 'core-js-compat' for a complete list of available modules

What it means

babel-preset-app's getPolyfills() filters the requested polyfill list against core-js-compat's compat data so it can decide, per browser target, whether each polyfill is actually needed. Every name in the `includes` list (from the preset's `polyfills`/`useBuiltIns` includes or the default list) must be a known key of `require('core-js-compat').data`. When a name is absent, the preset cannot compute its target requirements, so it throws rather than silently dropping or always including it.

Source

Thrown at packages/@vue/babel-preset-app/index.js:90

      ]
    },
    { ignoreBrowserslistConfig: true }
  )

  // use the intersection of browsers supporting Web Components and user defined targets config
  return getIntersectionTargets(targets, allWCTargets)
}

function getPolyfills (targets, includes) {
  // if no targets specified, include all default polyfills
  if (!targets || !Object.keys(targets).length) {
    return includes
  }

  const compatData = require('core-js-compat').data
  return includes.filter(item => {
    if (!compatData[item]) {
      throw new Error(`Cannot find polyfill ${item}, please refer to 'core-js-compat' for a complete list of available modules`)
    }

    return isRequired(item, targets, { compatData })
  })
}

module.exports = (context, options = {}) => {
  const presets = []
  const plugins = []
  const defaultEntryFiles = JSON.parse(process.env.VUE_CLI_ENTRY_FILES || '[]')

  // Though in the vue-cli repo, we only use the two environment variables
  // for tests, users may have relied on them for some features,
  // dropping them may break some projects.
  // So in the following blocks we don't directly test the `NODE_ENV`.
  // Rather, we turn it into the two commonly used feature flags.
  if (!process.env.VUE_CLI_TEST && process.env.NODE_ENV === 'test') {
    // Both Jest & Mocha set NODE_ENV to 'test'.

View on GitHub (pinned to 7eb93c169c)

Solutions

  1. Print valid names with `console.log(Object.keys(require('core-js-compat').data))` and correct/replace the offending entry.
  2. Use core-js 3 module-path naming (e.g. `es.promise`, `es.array.iterator`), not core-js 2 `es6.*` names.
  3. Update core-js-compat to a version consistent with your core-js major: `npm i -D core-js-compat`.
  4. Remove the custom polyfill entry if it is not actually needed.

Example fix

// before
module.exports = {
  presets: [['@vue/babel-preset-app', { polyfills: ['es6.promise', 'es.promise.finally'] }]]
}
// after
module.exports = {
  presets: [['@vue/babel-preset-app', { polyfills: ['es.promise', 'es.promise.finally'] }]]
}
Defensive patterns

Strategy: validation

Validate before calling

const compatData = require('core-js-compat').data
const requested = ['es.promise', 'es6.promise'] // your polyfills list
const unknown = requested.filter(name => !compatData[name])
if (unknown.length) {
  throw new Error(`Unknown polyfill names (not in core-js-compat): ${unknown.join(', ')}`)
}

Type guard

const isKnownPolyfill = (name) => Object.prototype.hasOwnProperty.call(require('core-js-compat').data, name)

Prevention

When it happens

Trigger: Passing a polyfill name to the babel preset that is not a key in core-js-compat.data. Concretely: a core-js 2-style path (`es6.promise`, `core-js/modules/es6.promise`), a typo (`es.promise.finall`), or a name valid only in a newer core-js-compat than the one installed.

Common situations: Upgrading or downgrading core-js / @vue/babel-preset-app across major versions; hand-editing the `polyfills` option in babel config; a stale lockfile resolving an older core-js-compat that lacks newer module names.

Related errors


AI-assisted analysis of vuejs/vue-cli@7eb93c169c (2026-08-13). Data as JSON: /api/errors/2edd50e7d21e942f. Report an issue: GitHub.