Skip to content

Commit

Permalink
Merge pull request #13533 from markjm/markjm/errors
Browse files Browse the repository at this point in the history
perf: Remove Error.captureStackTrace from all WebpackErrors
  • Loading branch information
sokra committed Jun 11, 2021
2 parents 6a4cb8e + ecf8728 commit ac97a27
Show file tree
Hide file tree
Showing 33 changed files with 0 additions and 64 deletions.
2 changes: 0 additions & 2 deletions lib/AsyncDependencyToInitialChunkError.js
Expand Up @@ -25,8 +25,6 @@ class AsyncDependencyToInitialChunkError extends WebpackError {
this.name = "AsyncDependencyToInitialChunkError";
this.module = module;
this.loc = loc;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/CaseSensitiveModulesWarning.js
Expand Up @@ -65,8 +65,6 @@ ${modulesList}`);

this.name = "CaseSensitiveModulesWarning";
this.module = sortedModules[0];

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/ChunkRenderError.js
Expand Up @@ -25,8 +25,6 @@ class ChunkRenderError extends WebpackError {
this.details = error.stack;
this.file = file;
this.chunk = chunk;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/CodeGenerationError.js
Expand Up @@ -23,8 +23,6 @@ class CodeGenerationError extends WebpackError {
this.message = error.message;
this.details = error.stack;
this.module = module;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/CommentCompilationWarning.js
Expand Up @@ -22,8 +22,6 @@ class CommentCompilationWarning extends WebpackError {
this.name = "CommentCompilationWarning";

this.loc = loc;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/ConcurrentCompilationError.js
Expand Up @@ -14,7 +14,5 @@ module.exports = class ConcurrentCompilationError extends WebpackError {
this.name = "ConcurrentCompilationError";
this.message =
"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time.";

Error.captureStackTrace(this, this.constructor);
}
};
2 changes: 0 additions & 2 deletions lib/DllReferencePlugin.js
Expand Up @@ -156,8 +156,6 @@ class DllManifestError extends WebpackError {

this.name = "DllManifestError";
this.message = `Dll manifest ${filename}\n${message}`;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/HarmonyLinkingError.js
Expand Up @@ -12,7 +12,5 @@ module.exports = class HarmonyLinkingError extends WebpackError {
super(message);
this.name = "HarmonyLinkingError";
this.hideStack = true;

Error.captureStackTrace(this, this.constructor);
}
};
1 change: 0 additions & 1 deletion lib/HookWebpackError.js
Expand Up @@ -32,7 +32,6 @@ class HookWebpackError extends WebpackError {
this.hideStack = true;
this.details = `caused by plugins in ${hook}\n${error.stack}`;

Error.captureStackTrace(this, this.constructor);
this.stack += `\n-- inner error --\n${error.stack}`;
}
}
Expand Down
2 changes: 0 additions & 2 deletions lib/InvalidDependenciesModuleWarning.js
Expand Up @@ -33,8 +33,6 @@ ${depsList.slice(0, 3).join("\n")}${
this.name = "InvalidDependenciesModuleWarning";
this.details = depsList.slice(3).join("\n");
this.module = module;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/ModuleBuildError.js
Expand Up @@ -53,8 +53,6 @@ class ModuleBuildError extends WebpackError {
this.name = "ModuleBuildError";
this.details = details;
this.error = err;

Error.captureStackTrace(this, this.constructor);
}

serialize(context) {
Expand Down
2 changes: 0 additions & 2 deletions lib/ModuleDependencyError.js
Expand Up @@ -30,8 +30,6 @@ class ModuleDependencyError extends WebpackError {
/** error is not (de)serialized, so it might be undefined after deserialization */
this.error = err;

Error.captureStackTrace(this, this.constructor);

if (err && /** @type {any} */ (err).hideStack) {
this.stack =
err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack;
Expand Down
2 changes: 0 additions & 2 deletions lib/ModuleDependencyWarning.js
Expand Up @@ -30,8 +30,6 @@ class ModuleDependencyWarning extends WebpackError {
/** error is not (de)serialized, so it might be undefined after deserialization */
this.error = err;

Error.captureStackTrace(this, this.constructor);

if (err && /** @type {any} */ (err).hideStack) {
this.stack =
err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack;
Expand Down
2 changes: 0 additions & 2 deletions lib/ModuleError.js
Expand Up @@ -37,8 +37,6 @@ class ModuleError extends WebpackError {
err && typeof err === "object" && err.stack
? cleanUp(err.stack, this.message)
: undefined;

Error.captureStackTrace(this, this.constructor);
}

serialize(context) {
Expand Down
2 changes: 0 additions & 2 deletions lib/ModuleNotFoundError.js
Expand Up @@ -80,8 +80,6 @@ class ModuleNotFoundError extends WebpackError {
this.module = module;
this.error = err;
this.loc = loc;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/ModuleParseError.js
Expand Up @@ -85,8 +85,6 @@ class ModuleParseError extends WebpackError {
this.name = "ModuleParseError";
this.loc = loc;
this.error = err;

Error.captureStackTrace(this, this.constructor);
}

serialize(context) {
Expand Down
2 changes: 0 additions & 2 deletions lib/ModuleRestoreError.js
Expand Up @@ -36,8 +36,6 @@ class ModuleRestoreError extends WebpackError {
this.details = details;
this.module = module;
this.error = err;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/ModuleStoreError.js
Expand Up @@ -36,8 +36,6 @@ class ModuleStoreError extends WebpackError {
this.details = details;
this.module = module;
this.error = err;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/ModuleWarning.js
Expand Up @@ -37,8 +37,6 @@ class ModuleWarning extends WebpackError {
warning && typeof warning === "object" && warning.stack
? cleanUp(warning.stack, this.message)
: undefined;

Error.captureStackTrace(this, this.constructor);
}

serialize(context) {
Expand Down
2 changes: 0 additions & 2 deletions lib/NoModeWarning.js
Expand Up @@ -18,7 +18,5 @@ module.exports = class NoModeWarning extends WebpackError {
"Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\n" +
"You can also set it to 'none' to disable any default behavior. " +
"Learn more: https://webpack.js.org/configuration/mode/";

Error.captureStackTrace(this, this.constructor);
}
};
2 changes: 0 additions & 2 deletions lib/NormalModule.js
Expand Up @@ -164,8 +164,6 @@ class NonErrorEmittedError extends WebpackError {

this.name = "NonErrorEmittedError";
this.message = "(Emitted value instead of an instance of Error) " + error;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/UnsupportedFeatureWarning.js
Expand Up @@ -21,8 +21,6 @@ class UnsupportedFeatureWarning extends WebpackError {
this.name = "UnsupportedFeatureWarning";
this.loc = loc;
this.hideStack = true;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/WarnDeprecatedOptionPlugin.js
Expand Up @@ -48,8 +48,6 @@ class DeprecatedOptionWarning extends WebpackError {
"configuration\n" +
`The value '${value}' for option '${option}' is deprecated. ` +
`Use '${suggestion}' instead.`;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/WebpackError.js
Expand Up @@ -31,8 +31,6 @@ class WebpackError extends Error {
this.chunk = undefined;
/** @type {string} */
this.file = undefined;

Error.captureStackTrace(this, this.constructor);
}

[inspect]() {
Expand Down
2 changes: 0 additions & 2 deletions lib/dependencies/CriticalDependencyWarning.js
Expand Up @@ -14,8 +14,6 @@ class CriticalDependencyWarning extends WebpackError {

this.name = "CriticalDependencyWarning";
this.message = "Critical dependency: " + message;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/dependencies/RequireIncludeDependencyParserPlugin.js
Expand Up @@ -67,8 +67,6 @@ class RequireIncludeDeprecationWarning extends WebpackError {
this.name = "RequireIncludeDeprecationWarning";

this.loc = loc;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/dependencies/SystemPlugin.js
Expand Up @@ -127,8 +127,6 @@ class SystemImportDeprecationWarning extends WebpackError {
this.name = "SystemImportDeprecationWarning";

this.loc = loc;

Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
1 change: 0 additions & 1 deletion lib/errors/BuildCycleError.js
Expand Up @@ -21,7 +21,6 @@ class BuildCycleError extends WebpackError {

this.name = "BuildCycleError";
this.module = module;
Error.captureStackTrace(this, this.constructor);
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/performance/AssetsOverSizeLimitWarning.js
Expand Up @@ -28,7 +28,5 @@ Assets: ${assetLists}`);

this.name = "AssetsOverSizeLimitWarning";
this.assets = assetsOverSizeLimit;

Error.captureStackTrace(this, this.constructor);
}
};
2 changes: 0 additions & 2 deletions lib/performance/EntrypointsOverSizeLimitWarning.js
Expand Up @@ -31,7 +31,5 @@ Entrypoints:${entrypointList}\n`);

this.name = "EntrypointsOverSizeLimitWarning";
this.entrypoints = entrypoints;

Error.captureStackTrace(this, this.constructor);
}
};
2 changes: 0 additions & 2 deletions lib/performance/NoAsyncChunksWarning.js
Expand Up @@ -16,7 +16,5 @@ module.exports = class NoAsyncChunksWarning extends WebpackError {
);

this.name = "NoAsyncChunksWarning";

Error.captureStackTrace(this, this.constructor);
}
};
2 changes: 0 additions & 2 deletions lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js
Expand Up @@ -12,7 +12,5 @@ module.exports = class UnsupportedWebAssemblyFeatureError extends WebpackError {
super(message);
this.name = "UnsupportedWebAssemblyFeatureError";
this.hideStack = true;

Error.captureStackTrace(this, this.constructor);
}
};
2 changes: 0 additions & 2 deletions lib/wasm-sync/WebAssemblyInInitialChunkError.js
Expand Up @@ -102,7 +102,5 @@ ${moduleChains.map(s => `* ${s}`).join("\n")}`;
this.name = "WebAssemblyInInitialChunkError";
this.hideStack = true;
this.module = module;

Error.captureStackTrace(this, this.constructor);
}
};

0 comments on commit ac97a27

Please sign in to comment.