import-loader
Webpack loader to import files at once with glob
It's just a concept yet
Install
npm install --save-dev import-loader
or
yarn add --dev import-loader
How to use
Quick
?glob
Use var models = // orvar models = // or
It will be something like that:
var models = 'models/User.js': 'models/Pet.js':
?name
Use ?name=basename
var models = // Its will like thatvar models = User: Pet:
?name=path
var models = // Its will like thatvar models = 'models/User.js': 'models/Pet.js':
?dir
and ?ext
Use If you have flat list of files in directory, you can drequire like that:
// or// or
Notes
- By default
?ext=js
- In
?dir
mode by default?name=basename
(if you want path, you need?name=path
)
.pattern
file
Use glob You can write your glob pattern If you have a large pattern file
- Create a glob pattern file (example:
models.pattern
)
./models/*.js
- Use glob file
var models = ;
Note: Pattern is relative to the file directory.
Other Examples
TODO
- source map