Skip to content
Latchkey

Rollup "(!) Missing global variable name" for UMD/IIFE in CI

A UMD or IIFE bundle needs to reference each external dependency by a browser global name. When an external has no entry in output.globals, Rollup warns it is guessing the name, which is usually wrong for the produced bundle.

What this error means

A UMD/IIFE build prints "(!) Missing global variable name" listing externals like react and "Guessing 'React'", and the resulting bundle references the wrong globals.

rollup
(!) Missing global variable name
https://rollupjs.org/configuration-options/#output-globals
Use "output.globals" to specify browser global variable names corresponding to
external modules:
react (guessing "react")

Common causes

Externals without a globals mapping

A UMD/IIFE output marks packages external but does not tell Rollup the global variable each maps to at runtime.

A new external added without updating globals

A dependency was externalized but output.globals was not extended to include its browser global name.

How to fix it

Provide output.globals for each external

  1. List the externals named in the warning.
  2. Map each to the global it exposes on window.
  3. Re-run so the UMD/IIFE bundle references the correct globals.
rollup.config.js
// rollup.config.js
export default {
  external: ['react', 'react-dom'],
  output: {
    format: 'umd',
    globals: { react: 'React', 'react-dom': 'ReactDOM' },
  },
};

Bundle the dependency instead

If you do not expect a global at runtime, remove it from external so Rollup includes it in the bundle.

How to prevent it

  • Keep output.globals in sync with every external for UMD/IIFE.
  • Decide per dependency whether to externalize or bundle it.
  • Use ESM output where browser globals are not required.

Frequently asked questions

What causes ""Missing global variable name""?
A UMD/IIFE output marks packages external but does not tell Rollup the global variable each maps to at runtime.
How do I fix "Missing global variable name"?
Provide output.globals for each external

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card