{"id":13447652,"url":"https://github.com/eight04/rollup-plugin-iife","last_synced_at":"2025-10-28T13:47:14.159Z","repository":{"id":32923989,"uuid":"146445368","full_name":"eight04/rollup-plugin-iife","owner":"eight04","description":"Convert ES modules into IIFEs.","archived":false,"fork":false,"pushed_at":"2024-02-16T08:34:26.000Z","size":422,"stargazers_count":41,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-17T12:20:31.273Z","etag":null,"topics":["iife","rollup","rollup-plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eight04.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-28T12:38:43.000Z","updated_at":"2024-06-18T18:40:34.727Z","dependencies_parsed_at":"2024-06-18T18:40:27.450Z","dependency_job_id":"5e138ba8-55a0-42ae-b57f-fbb6a2bd3ed0","html_url":"https://github.com/eight04/rollup-plugin-iife","commit_stats":{"total_commits":50,"total_committers":3,"mean_commits":"16.666666666666668","dds":0.06000000000000005,"last_synced_commit":"86e40cc19f703c31900f6f42f7a5ed08190967d2"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eight04%2Frollup-plugin-iife","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eight04%2Frollup-plugin-iife/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eight04%2Frollup-plugin-iife/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eight04%2Frollup-plugin-iife/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eight04","download_url":"https://codeload.github.com/eight04/rollup-plugin-iife/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243818194,"owners_count":20352629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iife","rollup","rollup-plugin"],"created_at":"2024-07-31T05:01:23.543Z","updated_at":"2025-10-28T13:47:14.066Z","avatar_url":"https://github.com/eight04.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Plugins"],"sub_categories":["Output"],"readme":"rollup-plugin-iife\n==================\n\n[![Build Status](https://travis-ci.com/eight04/rollup-plugin-iife.svg?branch=master)](https://travis-ci.com/eight04/rollup-plugin-iife)\n[![codecov](https://codecov.io/gh/eight04/rollup-plugin-iife/branch/master/graph/badge.svg)](https://codecov.io/gh/eight04/rollup-plugin-iife)\n[![install size](https://packagephobia.now.sh/badge?p=rollup-plugin-iife)](https://packagephobia.now.sh/result?p=rollup-plugin-iife)\n\nCurrently (rollup@0.65), [rollup doesn't support code splitting with IIFE output](https://github.com/rollup/rollup/issues/2072). This plugin would transform ES module output into IIFEs.\n\nInstallation\n------------\n\n```\nnpm install -D rollup-plugin-iife\n```\n\nUsage\n-----\n\n```js\nimport iife from \"rollup-plugin-iife\";\n\nexport default {\n  input: [\"entry.js\", \"entry2.js\"],\n  output: {\n    dir: \"dist\",\n    format: \"es\",\n    globals: {\n      vue: \"Vue\"\n    }\n  },\n  externals: [\"vue\"],\n  plugins: [iife()]\n};\n```\n\nDefine global variables for external imports\n--------------------------------------------\n\nYou can define global variables with `output.globals` just like before. You can also specify them with the plugin option `names`.\n\nThe plugin would first lookup `names` option then `output.globals`.\n\nAPI\n----\n\nThis module exports a single function.\n\n### iife\n\n```js\niife({\n  names?: Function|Object,\n  sourcemap?: Boolean,\n  prefix?: String,\n  strict?: Boolean\n}) =\u003e PluginInstance\n```\n\nCreate the plugin instance.\n\nIf `names` is a function, the signature is:\n\n```js\n(moduleId: String) =\u003e globalVariableName: String\n```\n\nIf `names` is an object, it is a `moduleId`/`globalVariableName` map. `moduleId` can be relative to the output folder (e.g. `./entry.js`), the plugin would resolve it to the absolute path.\n\nIf the plugin can't find a proper variable name, it would generate one according to its filename with [camelcase](https://www.npmjs.com/package/camelcase).\n\nIf `sourcemap` is false then don't generate the sourcemap. Default: `true`.\n\nWhen `prefix` is defined, it will be used to prefix auto-generated variable names. It doesn't prefix names defined in the `names` option. It doesn't prefix external imports.\n\nIf `strict` is true then add `'use strict';` directive to the IIFE. Default: `true`.\n\nRelated projects\n----------------\n\n* [rollup-plugin-external-globals](https://www.npmjs.com/package/rollup-plugin-external-globals) - transform imports into global variables *at transform hook*.\n* [amd-script](https://www.npmjs.com/package/amd-script) - a small AMD module cache that would work with AMD module chunks generated by Rollup. You have to load modules manually (e.g. load modules through `\u003cscript\u003e` tags).\n* [rollup-plugin-loadz0r](https://github.com/surma/rollup-plugin-loadz0r) - attach each chunk with a module loader so you don't have to include a module loader at runtime. Support workers.\n\nChangelog\n---------\n\n* 0.7.1 (Feb 16, 2024)\n\n  - Relax peer dependency. Support rollup 4.\n\n* 0.7.0 (Oct 20, 2022)\n\n  - Breaking: bump to rollup@3.\n  - Change: throw an error if `output.dir` is not defined.\n\n* 0.6.0 (Feb 11, 2022)\n\n  - Add: handle `import.meta.url`. The plugin also throws and error if it sees unconverted `import.meta`.\n\n* 0.5.0 (Feb 18, 2021)\n\n  - Now `'use strict';` directive is inserted by default.\n  - Add: `strict` option.\n\n* 0.4.0 (Dec 28, 2020)\n\n  - Fix: plugin name.\n  - **Bump dependencies. Update to rollup@2.35.1, replace camelcase with lodash/camelCase.**\n\n* 0.3.1 (Feb 8, 2020)\n\n  - Fix: prefix local imports.\n\n* 0.3.0 (Aug 14, 2019)\n\n  - Bump dependencies. Update to es-iife@0.2.0. Define default export with `var`.\n\n* 0.2.1 (Jun 23, 2019)\n\n  - Fix: handle empty chunks.\n\n* 0.2.0 (Jan 26, 2019)\n\n  - Breaking: bump rollup version to 1.x.\n\n* 0.1.2 (Jan 25, 2019)\n\n  - Add: `prefix` option.\n\n* 0.1.1 (Sep 28, 2018)\n\n  - Add: support `output.globals` option.\n\n* 0.1.0 (Aug 28, 2018)\n\n  - First release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feight04%2Frollup-plugin-iife","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feight04%2Frollup-plugin-iife","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feight04%2Frollup-plugin-iife/lists"}