babel-plugin-wrap-modules-amd

2.32.0 • Public • Published

babel-plugin-wrap-modules-amd

Wrap modules inside an AMD define() module.

Example

In

var console = require('console');
console.info('Say something');

Out

define(['module', 'exports', 'require', 'console'], function (
	module,
	exports,
	require
) {
	var console = require('console');
	console.log('Say something');
});

Installation

npm install --save-dev babel-plugin-wrap-modules-amd

Usage

Add the following to your .babelrc file:

{
	"plugins": ["wrap-modules-amd"]
}

Technical Details

This plugin wraps the code inside the module with an AMD define() call. The module is not given any name and any dependencies detected by inspecting require() calls are appended to the define() dependencies array so that they can be found when require() is called.

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-wrap-modules-amd

Weekly Downloads

7,242

Version

2.32.0

License

none

Unpacked Size

13.1 kB

Total Files

7

Last publish

Collaborators

  • antonio-ortega
  • daniel.sanz
  • izaera-lr
  • edalgrin
  • pat270
  • liferay
  • bryceosterhaus
  • matuzalemteles
  • gagranta
  • p2kmgcl
  • marko.cikos
  • kresimircoko
  • wincent
  • izaera