mirror of
https://github.com/morluto/rea.git
synced 2026-11-11 01:13:39 +00:00
fix(javascript): select JSON and addon loaders by exact suffix (#7821)
Node's CommonJS loader matches registered extensions case-sensitively, so
require("./data.JSON") and require("./addon.NODE") run as JavaScript.
Derive target_json_status and the native loads relation from the exact
loader suffix instead of the inventory's case-folded file kind.
Fixes #7623
This commit is contained in:
4 files changed
+70
-6
No files matched your search
@@ -8,6 +8,12 @@ export const isJsonModuleTarget = (
|
||||
): boolean =>
|
||||
path.endsWith(".json") && (kind === "json" || kind === "package-json");
|
||||
|
||||
/** Native-addon dispatch likewise needs the exact `.node` loader suffix. */
|
||||
export const isNativeAddonModuleTarget = (
|
||||
path: string,
|
||||
kind: JavaScriptArtifactFileKind | undefined,
|
||||
): boolean => path.endsWith(".node") && kind === "native-addon";
|
||||
|
||||
/** Loader evidence retained for a source-level module reference. */
|
||||
export type JavaScriptModuleResolutionMode =
|
||||
| "import"
|
||||
|
||||
Reference in new issue
Block a user