Skip to content

name

  • Type: optional name: string

Specifies the global variable name that contains the exports of umd / iife bundles.

Example

js
export default defineConfig({
  output: {
    format: 'iife',
    name: 'MyBundle',
  }
});
js
// output
var MyBundle = (function () {
  // ...
})();

Namespaces are supported i.e., your name can contain dots. The resulting bundle will contain the setup necessary for the namespacing.

js
// output for `name: 'a.b.c'`
this.a = this.a || {};
this.a.b = this.a.b || {};
this.a.b.c = (function () {
  // ...
})();

Released under the MIT License.