| [9af201e] | 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Tobias Koppers @sokra
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | const makeSerializable = require("../util/makeSerializable");
|
|---|
| 9 | const WebpackError = require("./WebpackError");
|
|---|
| 10 |
|
|---|
| 11 | /** @typedef {import("../Module")} Module */
|
|---|
| 12 |
|
|---|
| 13 | class InvalidDependenciesModuleWarning extends WebpackError {
|
|---|
| 14 | /**
|
|---|
| 15 | * Creates an instance of InvalidDependenciesModuleWarning.
|
|---|
| 16 | * @param {Module} module module tied to dependency
|
|---|
| 17 | * @param {Iterable<string>} deps invalid dependencies
|
|---|
| 18 | */
|
|---|
| 19 | constructor(module, deps) {
|
|---|
| 20 | const orderedDeps = deps ? [...deps].sort() : [];
|
|---|
| 21 | const depsList = orderedDeps.map((dep) => ` * ${JSON.stringify(dep)}`);
|
|---|
| 22 | super(`Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths.
|
|---|
| 23 | Invalid dependencies may lead to broken watching and caching.
|
|---|
| 24 | As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior.
|
|---|
| 25 | Loaders: Pass absolute paths to this.addDependency (existing files), this.addMissingDependency (not existing files), and this.addContextDependency (directories).
|
|---|
| 26 | Plugins: Pass absolute paths to fileDependencies (existing files), missingDependencies (not existing files), and contextDependencies (directories).
|
|---|
| 27 | Globs: They are not supported. Pass absolute path to the directory as context dependencies.
|
|---|
| 28 | The following invalid values have been reported:
|
|---|
| 29 | ${depsList.slice(0, 3).join("\n")}${
|
|---|
| 30 | depsList.length > 3 ? "\n * and more ..." : ""
|
|---|
| 31 | }`);
|
|---|
| 32 |
|
|---|
| 33 | /** @type {string} */
|
|---|
| 34 | this.name = "InvalidDependenciesModuleWarning";
|
|---|
| 35 | this.details = depsList.slice(3).join("\n");
|
|---|
| 36 | this.module = module;
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | makeSerializable(
|
|---|
| 41 | InvalidDependenciesModuleWarning,
|
|---|
| 42 | "webpack/lib/errors/InvalidDependenciesModuleWarning"
|
|---|
| 43 | );
|
|---|
| 44 |
|
|---|
| 45 | module.exports = InvalidDependenciesModuleWarning;
|
|---|