| | |
| | | /** @typedef {import("../../declarations/WebpackOptions").ChunkLoadingType} ChunkLoadingType */ |
| | | /** @typedef {import("../Compiler")} Compiler */ |
| | | |
| | | /** @type {WeakMap<Compiler, Set<ChunkLoadingType>>} */ |
| | | /** @typedef {Set<ChunkLoadingType>} ChunkLoadingTypes */ |
| | | |
| | | /** @type {WeakMap<Compiler, ChunkLoadingTypes>} */ |
| | | const enabledTypes = new WeakMap(); |
| | | |
| | | /** |
| | | * Returns enabled types. |
| | | * @param {Compiler} compiler compiler |
| | | * @returns {Set<ChunkLoadingType>} enabled types |
| | | * @returns {ChunkLoadingTypes} enabled types |
| | | */ |
| | | const getEnabledTypes = (compiler) => { |
| | | let set = enabledTypes.get(compiler); |
| | | if (set === undefined) { |
| | | /** @type {ChunkLoadingTypes} */ |
| | | set = new Set(); |
| | | enabledTypes.set(compiler, set); |
| | | } |
| | |
| | | |
| | | class EnableChunkLoadingPlugin { |
| | | /** |
| | | * Creates an instance of EnableChunkLoadingPlugin. |
| | | * @param {ChunkLoadingType} type library type that should be available |
| | | */ |
| | | constructor(type) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Updates enabled using the provided compiler. |
| | | * @param {Compiler} compiler the compiler instance |
| | | * @param {ChunkLoadingType} type type of library |
| | | * @returns {void} |
| | |
| | | } |
| | | |
| | | /** |
| | | * Checks enabled. |
| | | * @param {Compiler} compiler the compiler instance |
| | | * @param {ChunkLoadingType} type type of library |
| | | * @returns {void} |
| | |
| | | } |
| | | |
| | | /** |
| | | * Apply the plugin |
| | | * Applies the plugin by registering its hooks on the compiler. |
| | | * @param {Compiler} compiler the compiler instance |
| | | * @returns {void} |
| | | */ |
| | |
| | | }).apply(compiler); |
| | | break; |
| | | } |
| | | case "import": |
| | | case "universal": { |
| | | case "import": { |
| | | const ModuleChunkLoadingPlugin = require("../esm/ModuleChunkLoadingPlugin"); |
| | | |
| | | new ModuleChunkLoadingPlugin().apply(compiler); |