Can't support webpack!
weineel opened this issue · comments
Will the support of webpack be added?
That would be really nice, this lib breaks packages that require it, if using webpack.
You can use require.context to get the same behaviour:
let context = require.context('../some/directory', false, /onlyinclude.js$/);
context.keys().forEach(filename => {
let obj = context(filename);
obj.someFuntion();
});
This works with webpack.
For anyone else looking for a solution for webpack, you can use this babel plugin:
https://github.com/vihanb/babel-plugin-wildcard
Benefit is it's all done compile-time 🎉
Works great for me 👍