How does webpack determine which files/folders it will include in a bundle

爷,独闯天下 提交于 2020-01-16 09:07:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!