Skip to content

Commit

Permalink
chore: replace hardcoded regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
tthijm committed Feb 27, 2024
1 parent 611bded commit 704f0f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/DefinePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

"use strict";

const globToRegex = require("glob-to-regexp");
const {
JAVASCRIPT_MODULE_TYPE_AUTO,
JAVASCRIPT_MODULE_TYPE_ESM,
Expand Down Expand Up @@ -308,8 +309,10 @@ const PLUGIN_NAME = "DefinePlugin";
const VALUE_DEP_PREFIX = `webpack/${PLUGIN_NAME} `;
const VALUE_DEP_MAIN = `webpack/${PLUGIN_NAME}_hash`;
const TYPEOF_OPERATOR_REGEXP = /^typeof\s+/;
const WEBPACK_REQUIRE_FUNCTION_REGEXP = /__webpack_require__\s*(!?\.)/;
const WEBPACK_REQUIRE_IDENTIFIER_REGEXP = /__webpack_require__/;
const WEBPACK_REQUIRE_FUNCTION_REGEXP = globToRegex(
RuntimeGlobals.requireScope
);
const WEBPACK_REQUIRE_IDENTIFIER_REGEXP = globToRegex(RuntimeGlobals.require);

class DefinePlugin {
/**
Expand Down

0 comments on commit 704f0f4

Please sign in to comment.