Miss any of our Open RFC calls?Watch the recordings here! »

babel-plugin-transform-glob-import

1.0.1 • Public • Published

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

Keywords

none

Install

npm i babel-plugin-transform-glob-import

DownloadsWeekly Downloads

249

Version

1.0.1

License

MIT

Last publish

Collaborators

  • avatar