Skip to content

globals

  • Type: optional globals: Record<string, string> | (name) => string

Specifies id: variableName pairs necessary for external imports in umd / iife bundles.

Example

js
export default defineConfig({
  external: ['jquery'],
  output: {
    format: 'iife',
    name: 'MyBundle',
    globals: {
      jquery: '$',
    }
  }
});
js
// input
import $ from 'jquery';
js
// output
var MyBundle = (function ($) {
  // ...
})($);

Released under the MIT License.