Y
Y
ymdd2020-10-03 10:40:10
Node.js
ymdd, 2020-10-03 10:40:10

How to import modules automatically after webpack build?

Hello.

Now the project has a need to load some modules automatically after assembly (using dynamic import). The problem is that after the assembly by Webpack, there is only one file left, inside which all the sources are packed. Earlier I tried to use Babel for assembly, it saves the structure, there were no problems there, but it was decided to switch to Webpack. The modules themselves are resolved using the usual `readdir`, and then driven into Promise.all(paths.map(path => import(path)), which does not work with webpack.
Is it possible to implement this now? Grateful for any help and advice

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question