简体   繁体   English

Webpack库输出

[英]Webpack Library Output

How does Webpack know which files to include in library build? Webpack如何知道要在库构建中包括哪些文件? How does it know which files should not or should be included, as in miscellaneous files like images, examples, documentation, etc. If it automatically includes them how do we make Webpack ignore these included files? 它如何知道不应该或应该包含哪些文件,例如图像,示例,文档等杂项文件。如果它自动包含这些文件,我们如何使Webpack忽略这些包含的文件?

Webpack scans the actual JS files themselves, starting at your entry point(s) and recursively scanning each referenced file, to determine what to build. Webpack会从入口点开始扫描实际的JS文件本身,然后递归地扫描每个引用的文件,以确定要构建的文件。 It won't include any other files like examples or documentation unless you for some reason are include/requiring them from your javascript. 它将不包括任何其他文件,例如示例或文档,除非您出于某种原因从javascript中包含/要求它们。

Things like CSS/LESS/SASS and images are built with specific loaders which generally also only build referenced files. CSS / LESS / SASS和图像之类的东西是使用特定的加载程序构建的,这些加载程序通常也仅构建引用的文件。

TL;DR: If it isn't explicitly included somewhere, it probably isn't in the build. TL; DR:如果未明确包含在某处,则它可能不在构建中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM