How does the webpack create a file directory when packaging

  node.js, question

I want to go through all the files in a folder and get a collection of all the file names when packing. The traversal can be completed by using nodejs method. the puzzle now is where this code should be placed so that the webpack can be executed when it is packaged and then passed to the page so that the page can read this directory when the website goes online.

All right, I’m done. Just write a custom file to js before the build command of package.json. .

"scripts": {
    "dev":   "node build/create-index.js && node build/dev-server.js",
    "build": "node build/create-index.js && node build/build.js"
 }