Convert ES modules into IIFEs.
npm install rollup-plugin-iiferollup-plugin-iife
==================



Currently (rollup@0.65), rollup doesn't support code splitting with IIFE output. This plugin would transform ES module output into IIFEs.
Installation
------------
``
`
npm install -D rollup-plugin-iife
`
Usage
-----
js
`
import iife from "rollup-plugin-iife";
export default {
input: ["entry.js", "entry2.js"],
output: {
dir: "dist",
format: "es",
globals: {
vue: "Vue"
}
},
externals: ["vue"],
plugins: [iife()]
};
output.globals
Define global variables for external imports
--------------------------------------------
You can define global variables with just like before. You can also specify them with the plugin option names.
names
The plugin would first lookup option then output.globals.
`
API
----
This module exports a single function.
$3
js
`
iife({
names?: Function|Object,
sourcemap?: Boolean,
prefix?: String,
strict?: Boolean
}) => PluginInstance
names
Create the plugin instance.
If is a function, the signature is:
`
js
`
(moduleId: String) => globalVariableName: String
names
If 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.
sourcemap
If the plugin can't find a proper variable name, it would generate one according to its filename with camelcase.
If is false then don't generate the sourcemap. Default: true.
prefix
When 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.
strict
If is true then add 'use strict'; directive to the IIFE. Default: true.
Related projects
----------------
rollup-plugin-external-globals - transform imports into global variables at transform hook*.
* 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