Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove v8-compile-cache #3006

Merged
merged 2 commits into from Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions packages/webpack-cli/bin/cli.js
Expand Up @@ -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");

Expand All @@ -20,4 +14,4 @@ if (!process.env.WEBPACK_CLI_SKIP_IMPORT_LOCAL) {

process.title = "webpack";

runCLI(process.argv, originalModuleCompile);
runCLI(process.argv);
4 changes: 1 addition & 3 deletions 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);
Expand Down
15 changes: 0 additions & 15 deletions 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");
Expand Down Expand Up @@ -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 &&
Expand Down
1 change: 0 additions & 1 deletion packages/webpack-cli/package.json
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Expand Up @@ -10798,7 +10798,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==
Expand Down