https://github.com/devongovett/babel-plugin-transform-glob-import
Import multiple files at once with globs
https://github.com/devongovett/babel-plugin-transform-glob-import
Last synced: 3 months ago
JSON representation
Import multiple files at once with globs
- Host: GitHub
- URL: https://github.com/devongovett/babel-plugin-transform-glob-import
- Owner: devongovett
- Created: 2017-09-29T16:29:52.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-04-13T12:16:25.000Z (about 5 years ago)
- Last Synced: 2025-04-02T12:23:30.321Z (about 1 year ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 5
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# babel-plugin-transform-glob-import
Import multiple files at once with globs
## Example
Importing both `dir/a.js` and `dir/b.js` at once:
```javascript
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:
```javascript
// 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:
```javascript
// imports only dir/a.js, and dir/b.js
import {a, b} from './dir/*.js';
```
## License
MIT