babel-plugin-glob-imports

v1.0.0-beta.1
[![Build Status](https://travis-ci.org/geowarin/babel-plugin-glob-imports.svg?branch=master)](https://travis-ci.org/geowarin/babel-plugin-glob-imports)
babel-plugin

babel-plugin-glob-imports

Build Status

A babel plugin which allows you to import modules from glob expressions.

Example

Before:

import myModule from './src/**/*.js';

After:

import * as one from './src/subdir/one.js';
import * as two from './src/subdir/otherdir/two.js';
const myModule = {
  one: one,
  two: two
}

Limitations

This module is a bit opinionated:

  • All files resolved by the glob must have unique names
  • You can only use the global import with globs (Forbidden: import {something} from "./glob/*.js")
npm i babel-plugin-glob-imports

Metadata

  • ISC
  • Whatever
  • Unknown
  • released 5/12/2016

Downloads

Maintainers