sleexyz / dir-loader

Dynamically require a directory in Webpack. Use Webpack as a CMS!
13 stars 5 forks source link

Load directory without an extra config file #17

Open dundalek opened 7 years ago

dundalek commented 7 years ago

Hi, this is an interesting approach. Do you think it would be somehow possible to hack webpack to load directories without the extra config file?

As an example let's say we have:

.
├── submodule
│   ├── a.js
│   └── b.js
|
└── entry.js

From entry.js I would like to do:

import { a, b } from 'dir!./submodule';

Instead of regular:

import a from './submodule/a';
import b from './submodule/b';