diff --git a/packages/webpack-cli/bin/cli.js b/packages/webpack-cli/bin/cli.js index 91b0cd4b17f..5305a836bfd 100755 --- a/packages/webpack-cli/bin/cli.js +++ b/packages/webpack-cli/bin/cli.js @@ -2,12 +2,6 @@ "use strict"; -const Module = require("module"); - -const originalModuleCompile = Module.prototype._compile; - -require("v8-compile-cache"); - const importLocal = require("import-local"); const runCLI = require("../lib/bootstrap"); @@ -20,4 +14,4 @@ if (!process.env.WEBPACK_CLI_SKIP_IMPORT_LOCAL) { process.title = "webpack"; -runCLI(process.argv, originalModuleCompile); +runCLI(process.argv); diff --git a/packages/webpack-cli/lib/bootstrap.js b/packages/webpack-cli/lib/bootstrap.js index c43c8442e25..ef63a0b15da 100644 --- a/packages/webpack-cli/lib/bootstrap.js +++ b/packages/webpack-cli/lib/bootstrap.js @@ -1,12 +1,10 @@ const WebpackCLI = require("./webpack-cli"); -const runCLI = async (args, originalModuleCompile) => { +const runCLI = async (args) => { // Create a new instance of the CLI object const cli = new WebpackCLI(); try { - cli._originalModuleCompile = originalModuleCompile; - await cli.run(args); } catch (error) { cli.logger.error(error); diff --git a/packages/webpack-cli/lib/webpack-cli.js b/packages/webpack-cli/lib/webpack-cli.js index 0e47fcac530..42c25156f94 100644 --- a/packages/webpack-cli/lib/webpack-cli.js +++ b/packages/webpack-cli/lib/webpack-cli.js @@ -1,7 +1,6 @@ const fs = require("fs"); const path = require("path"); const { pathToFileURL } = require("url"); -const Module = require("module"); const util = require("util"); const { program, Option } = require("commander"); @@ -244,21 +243,7 @@ class WebpackCLI { try { result = require(module); } catch (error) { - let previousModuleCompile; - - // TODO Workaround https://github.com/zertosh/v8-compile-cache/issues/30 - if (this._originalModuleCompile) { - previousModuleCompile = Module.prototype._compile; - - Module.prototype._compile = this._originalModuleCompile; - } - const dynamicImportLoader = require("./utils/dynamic-import-loader")(); - - if (this._originalModuleCompile) { - Module.prototype._compile = previousModuleCompile; - } - if ( (error.code === "ERR_REQUIRE_ESM" || process.env.WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG) && pathToFileURL && diff --git a/packages/webpack-cli/package.json b/packages/webpack-cli/package.json index 2e61eac986d..1767f150d1b 100644 --- a/packages/webpack-cli/package.json +++ b/packages/webpack-cli/package.json @@ -40,7 +40,6 @@ "import-local": "^3.0.2", "interpret": "^2.2.0", "rechoir": "^0.7.0", - "v8-compile-cache": "^2.2.0", "webpack-merge": "^5.7.3" }, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index b20ccb7b325..e5f6319e62b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10814,7 +10814,7 @@ uuid@^3.3.2, uuid@^3.3.3, uuid@^3.4.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -v8-compile-cache@^2.0.3, v8-compile-cache@^2.2.0: +v8-compile-cache@^2.0.3: version "2.3.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==