Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ember-engines/babel-plugin-compact-reexports
A Babel plugin to make re-export modules more compact
https://github.com/ember-engines/babel-plugin-compact-reexports
amd babel babel-plugin ember
Last synced: 3 months ago
JSON representation
A Babel plugin to make re-export modules more compact
- Host: GitHub
- URL: https://github.com/ember-engines/babel-plugin-compact-reexports
- Owner: ember-engines
- Created: 2017-05-01T22:37:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-18T16:29:07.000Z (about 6 years ago)
- Last Synced: 2024-10-31T08:05:29.247Z (3 months ago)
- Topics: amd, babel, babel-plugin, ember
- Language: JavaScript
- Size: 43 KB
- Stars: 1
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# babel-plugin-compact-reexports
[![Build Status](https://travis-ci.org/ember-engines/babel-plugin-compact-reexports.svg?branch=master)](https://travis-ci.org/ember-engines/babel-plugin-compact-reexports)
[![Coverage Status](https://coveralls.io/repos/github/ember-engines/babel-plugin-compact-reexports/badge.svg)](https://coveralls.io/github/ember-engines/babel-plugin-compact-reexports)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](https://github.com/ember-cli/loader.js), but could work with any AMD loader that supports a similar [`alias` API](https://github.com/ember-cli/loader.js/blob/5d95319c2ce779dd80ed3f57748da0eb0883ced6/lib/loader/loader.js#L255-L261).
_Original discussion: [ember-engines/ember-engines#265](https://github.com/ember-engines/ember-engines/issues/265)_
## What It Does
Given a re-export module:
```js
// my-module.js
export { default } from 'their-module';
```When using AMD, this would normally compile to something like:
```js
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:
```js
define.alias('their-module', 'my-module');
```