Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

demodule

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

demodule

bundle javascript files into one for the browser

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Demodule - CommonJS for the browser!

A simple tool to package javascript files into one using CommonJS module specification.
If you want to structure your browser client code using CommonJS (like NodeJS's 'require()'), this is for you.

  • Explicitly define which files to include
  • Recursive require() support
  • Minimization

Example

This is a sample build script using Demodule.
You can see the full example in the example folder.

var demodule = require("demodule");
var fs = require("fs");

var dependencies = [
    // a single file
    {name:"app", path:"./app.js"},

    // a library from NPM
    {name:"underscore", path:"./node_modules/underscore/underscore.js"},

    // a whole directory, recursively.
    {name:"lib", path:"./lib"},

    // another whole directory
    {name:"foo", path:"./foo"},
];

var entry = 'require("app").run();';

var code = demodule(dependencies, entry, {minify: false, debug:true});

var err = fs.writeFileSync("build/app.js", code);

if (err) { throw(err); }

Installation

Requires NodeJS.

See the example app for usage.

FAQs

Package last updated on 24 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc