webpack/lib/cache/AddBuildDependenciesPlugin.js

33 lines
740 B
JavaScript
Raw Normal View History

2019-08-09 20:46:42 +08:00
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("../Compiler")} Compiler */
2025-06-04 02:20:37 +08:00
const PLUGIN_NAME = "AddBuildDependenciesPlugin";
2019-08-09 20:46:42 +08:00
class AddBuildDependenciesPlugin {
/**
* @param {Iterable<string>} buildDependencies list of build dependencies
*/
constructor(buildDependencies) {
this.buildDependencies = new Set(buildDependencies);
}
/**
2020-04-23 16:48:36 +08:00
* Apply the plugin
* @param {Compiler} compiler the compiler instance
2019-08-09 20:46:42 +08:00
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
2025-06-04 02:20:37 +08:00
compilation.buildDependencies.addAll(this.buildDependencies);
});
2019-08-09 20:46:42 +08:00
}
}
module.exports = AddBuildDependenciesPlugin;