The [contenthash] placeholder will add a unique hash based on the content of the sprite. Meaning if splitting into a chunk does not reduce the size of the main chunk (bundle) by the given amount of bytes, it won't be split, even if it meets the splitChunks.minSize value. The plugin automatically cleans all SVGs before creating the sprite. The algorithm is deterministic and changes to the modules will only have local effects. Michael is a Full Stack Developer from China who loves writing code, tutorials about Django, and modern frontend tech. With reusable components, SVGs are often duplicated on all the project. Each sprite filename is composed with its entrypoint name (in the example below, that would be home.svg). First, let's add the loader and the plugin to the Webpack configuration. For more information on the reason behind this, read webpack 4: import() and CommonJs. This might result in a large chunk containing all external packages. The [contenthash] placeholder is the best option because it depends on the sprite content. Since webpack v4, the CommonsChunkPlugin was removed in favor of optimization.splitChunks. Load bundle file with splitChunks and Django static new rev2023.4.21.43403. 2. When assigning equal names to different split chunks, all vendor modules are placed into a single shared chunk, though it's not recommend since it can result in more code downloaded. A preloaded chunk starts loading in parallel to the parent chunk. Using webpackPreload incorrectly can actually hurt performance, so be careful when using it. chainWebpackoptimization.splitChunkscacheGroups. Avoid setting it globally. The optimization will prefer the cache group with a higher priority. Webpack will create its own script and any error will be processed without any timeouts. Omitting it selects all modules. Tells the plugin whether to generate the sprites-preview.html. To disable any of the default cache groups, set them to false. Size threshold at which splitting is enforced and other restrictions (minRemainingSize, maxAsyncRequests, maxInitialRequests) are ignored. This step will allow clients to request even less from the server to stay up to date. The loader and the plugin accepts configuration to override the default behavior. Minimum size reduction to the main chunk (bundle), in bytes, needed for a chunk to be generated. Which one to choose? I tried to add a rule so that the name of the imported js files do not change, Finally, use the SVG with the