🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

babel-plugin-transform-glob-import

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-glob-import

Import multiple files at once with globs

1.0.1
latest
npm
Version published
Weekly downloads
3.4K
-20.59%
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 14 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts