Skip to content

ember-engines/babel-plugin-compact-reexports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-compact-reexports

Build Status Coverage Status

Allows ES modules which just re-export contents of other modules to be more compact; saving you bytes over the wire.

This plugin is designed to work with loader.js, but could work with any AMD loader that supports a similar alias API.

Original discussion: ember-engines/ember-engines#265

What It Does

Given a re-export module:

// my-module.js
export { default } from 'their-module';

When using AMD, this would normally compile to something like:

define('my-module', ['exports', 'their-module'], function (exports, _theirModule) {
  'use strict';

  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _theirModule['default'];
    }
  });
});

Which is pretty verbose for a simple re-export. This plugin will rewrite the above to the following:

define.alias('their-module', 'my-module');

About

A Babel plugin to make re-export modules more compact

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •