From a289a948935e2686255f76ade6066cf49f02a9b7 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 8 Sep 2026 16:22:47 +0000 Subject: [PATCH] fix: accept a `file://` prefix in an absolute path The pre-compiled schemas hoist their own copy of the regexp the `absolutePath` keyword of `schema-utils` uses. `schema-utils` 4.4.0 accepts an optional `file://` prefix, so a path from `import.meta.resolve()` can be passed to an option that takes an absolute path, and this copy has to accept it too. While the two disagree, the pre-compiled schema rejects a value the real one accepts, which makes webpack fall back to the real schema on every validation and warn `DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID`. --- precompile-schemas/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/precompile-schemas/index.js b/precompile-schemas/index.js index 105db67..69f356a 100644 --- a/precompile-schemas/index.js +++ b/precompile-schemas/index.js @@ -128,8 +128,10 @@ const processJson = processSchema.bind(null, { const postprocess = async (code) => { // add hoisted values + // Keep in sync with the `absolutePath` keyword of `schema-utils`, the + // pre-compiled schema has to accept exactly what the real one accepts if (/absolutePathRegExp/.test(code)) - code = `const absolutePathRegExp = /^(?:[A-Za-z]:[\\\\/]|\\\\\\\\|\\/)/;${code}`; + code = `const absolutePathRegExp = /^(?:file:\\/\\/)?(?:[A-Za-z]:[\\\\/]|\\\\\\\\|\\/)/;${code}`; // remove unnecessary error code: code = code