babel-plugin-amd-namer

0.0.1 • Public • Published

babel-plugin-amd-namer

A Babel plugin to name anonymous AMD modules

This task is useful if you're using an AMD loader that requires modules to have explicit names (e.g. almond).

Example

Input src/simple/actual.js

define(function() {
  return 'a';
});

Output dist/simple/actual.js

'use strict';

define('dist/simple/actual', function () {
  return 'a';
});

Getting started

Installation

$ npm install babel-plugin-amd-namer

Usage

{
  "plugins": ["amd-namer"],
  "moduleIds": true, //mandatory!
  "sourceRoot": "src",
  "moduleRoot": "dist"
}

This plugin uses the same module naming logic as the built-in babel plugins (e.g. transform-es2015-modules-amd). This means that it calls the internal babel method getModuleName to decide what the module name should be. See the Babel Options docs for customization info.

Running tests

Run mocha tests with npm test

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-amd-namer

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • cowchimp