问题
I have a set of files in my project's src/main/resources folder - such as index.html, myproject.css, i18n.js
When I run webpack only one file is automatically copied over to the bundle, namely 118n.js. Why does this get bundled but nothing else?
回答1:
Currently, all the .js
files on the classpath are eligible to be bundled. This is why your i18n.js
file is included in the resulting bundle.
Note, however, that it is not planned to continue to support this behavior (relying on .js
files on the classpath). Instead, you should include which resources are eligible to be bundled with the jsSourceDirectories
setting key. For instance, to include all the files of the src/main/resources
directory:
jsSourceDirectories += (Compile / resourceDirectory).value
来源:https://stackoverflow.com/questions/56817194/how-does-webpack-determine-which-files-folders-it-will-include-in-a-bundle