source: imaps-frontend/node_modules/webpack/lib/ids/NaturalChunkIdsPlugin.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 984 bytes
RevLine 
[79a0317]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const { compareChunksNatural } = require("../util/comparators");
9const { assignAscendingChunkIds } = require("./IdHelpers");
10
11/** @typedef {import("../Chunk")} Chunk */
12/** @typedef {import("../Compiler")} Compiler */
13/** @typedef {import("../Module")} Module */
14
15class NaturalChunkIdsPlugin {
16 /**
17 * Apply the plugin
18 * @param {Compiler} compiler the compiler instance
19 * @returns {void}
20 */
21 apply(compiler) {
22 compiler.hooks.compilation.tap("NaturalChunkIdsPlugin", compilation => {
23 compilation.hooks.chunkIds.tap("NaturalChunkIdsPlugin", chunks => {
24 const chunkGraph = compilation.chunkGraph;
25 const compareNatural = compareChunksNatural(chunkGraph);
26 const chunksInNaturalOrder = Array.from(chunks).sort(compareNatural);
27 assignAscendingChunkIds(chunksInNaturalOrder, compilation);
28 });
29 });
30 }
31}
32
33module.exports = NaturalChunkIdsPlugin;
Note: See TracBrowser for help on using the repository browser.