babel-plugin-transform-glob-import
Import multiple files at once with globs
Last updated 2 years ago by devongovett .
MIT · Original npm · Tarball · package.json
$ cnpm install babel-plugin-transform-glob-import 
SYNC missed versions from official npm registry.

babel-plugin-transform-glob-import

Import multiple files at once with globs

Example

Importing both dir/a.js and dir/b.js at once:

import vars from './dir/*.js';

console.log(vars.a, vars.b);

You can also import deeply nested globs. The result is a nested object for each directory:

// import dir/a.js and dir/b/c.js
import vars from './dir/**/*.js';

console.log(vars.a, vars.b.c);

Importing only some files with destructuring also works:

// imports only dir/a.js, and dir/b.js
import {a, b} from './dir/*.js';

License

MIT

Current Tags

  • 1.0.1                                ...           latest (2 years ago)

2 Versions

  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 1
Last Month 1
Dependencies (3)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |