A CommonJS wrapping module for Mimosa AMD/RequireJS projects
npm install mimosa-require-commonjs
|1||downloads in the last day|
|22||downloads in the last week|
|51||downloads in the last month|
|Version||1.0.1 last updated 6 days ago|
|Keywords||mimosa, mmodule, commonjs, amd, requirejs|
This is a Mimosa module for wrapping browser code written in CommonJS with requirejs' simplified CommonJS wrapper. This is an external module and does not come by default with Mimosa.
This module provides CommonJS support via RequireJS and AMD. So if you are a fan of writing your modules in the CommonJS style, but want to use AMD in the browser and take advantage of all that RequireJS' configuration allows you, like, among other things, creating module path shortcuts and aliases, then this is the module for you.
Stated differently, this module allows you to write your AMD/RequireJS application using CommonJS.
Because this module still leverages AMD/RequireJS, when you write your browser code in CommonJS, you will still take advantage of all of the functionality provided by the
mimosa-require module, like path verification, and circular dependency checking and on-the-fly optimization if your entire application.
For more information regarding Mimosa, see http://mimosa.io
'require-commonjs' to your list of modules. That's all! Mimosa will install the module for you when you start up.
If you are using
"use strict" in your code, and you are using the
mimosa-lint module, you'll want to make sure that in your list of modules,
require-commonjs comes before
lint. If it comes after
mimosa-lint may complain about certain objects not being available that are provided by the
The module performs this wrapping during the
afterCompile step of the
The module will not wrap files that it determines are already wrapped in a
define block. It will also not wrap files that match the
requireCommonjs.exclude regexes. See config below.
requireCommonjs: exclude:[/[/\\]vendor[/\\]/, /[/\\]main[\.-]/]
The AngularFunMimosaCommonJS project is a working example of a project that uses Mimosa and CommonJS. Check it out. Hopefully it'll answer any questions you have.