From d9f383f90c1808fedcba8794918d925119a9a0c5 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Fri, 21 Nov 2025 14:36:00 -0800 Subject: [PATCH] Fix issue where ignoring ERR_MODULE_NOT_FOUND errors when importing the rspack config masks legitimate import issues --- .../bmiddha-rspack-config-load_2025-11-21-22-35.json | 10 ++++++++++ .../src/RspackConfigurationLoader.ts | 5 ----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 common/changes/@rushstack/heft-rspack-plugin/bmiddha-rspack-config-load_2025-11-21-22-35.json diff --git a/common/changes/@rushstack/heft-rspack-plugin/bmiddha-rspack-config-load_2025-11-21-22-35.json b/common/changes/@rushstack/heft-rspack-plugin/bmiddha-rspack-config-load_2025-11-21-22-35.json new file mode 100644 index 00000000000..0af39f23ca2 --- /dev/null +++ b/common/changes/@rushstack/heft-rspack-plugin/bmiddha-rspack-config-load_2025-11-21-22-35.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/heft-rspack-plugin", + "comment": "Fix issue where ignoring ERR_MODULE_NOT_FOUND errors when importing the rspack config masks legitimate import issues.", + "type": "patch" + } + ], + "packageName": "@rushstack/heft-rspack-plugin" +} \ No newline at end of file diff --git a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts index 3864f08dc6f..98a6d37fdcf 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts @@ -177,11 +177,6 @@ export async function _tryLoadRspackConfigurationFileInnerAsync( const configurationUri: string = pathToFileURL(configurationPath).href; return await import(configurationUri); } catch (e) { - const error: NodeJS.ErrnoException = e as NodeJS.ErrnoException; - if (error.code === 'ERR_MODULE_NOT_FOUND') { - // No configuration found, return undefined. - return undefined; - } throw new Error(`Error loading Rspack configuration at "${configurationPath}": ${e}`); } } else {