1.0.0-beta.1 • Published 8 years ago

babel-plugin-glob-imports v1.0.0-beta.1

Weekly downloads
-
License
ISC
Repository
-
Last release
8 years ago

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")