cjs2iife

0.1.2 • Public • Published

cjs2iife

Build Status Dependencies devDependency Status NPM Version Coverage Status

Convert all commonjs files to one immediately-invoked-function-expression file

Background

When you wanna develop a library, but you don't need to support AMD or CommonJS or CMD or UMD in production environment. Finnaly you only need a combined iife file to deploy. Howerver, the library code base is not small, you still need a module style to manage your source code to avoid your code in mess. This tool is for it, you can using CommonJS module style to write your code, and use this tool to pack to one iife file.

Usage

Install

npm install cjs2iife

Example

var cjs2iife = require('cjs2iife');
var result = cjs2iife({
    dir: 'src',     // the source base dir
    main: 'index',  // the entry module to pack
    compress: true, // enable the compress option, optional, default not compress
    output: 'dist/combine.min.js', // the output file path, optional
    exports: 'myGlobalObj' // the variable name to export to window object, optional
});

Readme

Keywords

Package Sidebar

Install

npm i cjs2iife

Weekly Downloads

1

Version

0.1.2

License

MIT

Last publish

Collaborators

  • wuhuiyao