source: trip-planner-front/node_modules/webpack/lib/ids/NaturalChunkIdsPlugin.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 984 bytes
RevLine 
[6a3a178]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.