Answer the question
In order to leave comments, you need to log in
Is it possible to auto-import BEM blocks in webpack?
Let's say I have a bunch of blocks and the same bunch of pages... How do I create entry points for them? For each page to register imports? Is it possible to auto-import BEM blocks that are used on the page? Is there any loader for this? Or is it all manual?
Now I'm using this script:
let files = [];
function importAll(r) {
r.keys().forEach((s, i) => {
files[i] = r(s);
});
}
importAll(require.context('../blocks/', true, /(\.less|\.js)$/));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question