You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tsconfig.paths alias is not resolved for JSON imports with with { type: "json" } #726
oxnode should resolve #/configs/cfg.json using the tsconfig.jsoncompilerOptions.paths configuration, just as it does for TypeScript imports without the JSON import attribute.
Actual behavior
Running:
oxnode src/index.ts
fails with:
node:internal/modules/run_main:107
triggerUncaughtException(
^
TypeError [ERR_PACKAGE_IMPORT_NOT_DEFINED]: Package import specifier "#/configs/cfg.json" is not defined in package D:\Repositories\synchronous-chat\package.json imported from D:\Repositories\synchronous-chat\src\app.ts
This suggests that the #/configs/cfg.json specifier is reaching Node's native ESM resolver without being resolved through the tsconfig.paths configuration first.
Comparison
The same import works with:
tsx src/index.ts → works
tsc -b → works
tsc-alias → works
node dist/... → works
oxnode src/index.ts → fails
The JSON file itself does not appear to be the issue.
Additional observations
Removing the import attribute:
importconfigsfrom"#/configs/cfg.json";
makes the alias work with oxnode.
Alternatively, adding a corresponding imports mapping to package.json also makes it work.
For example:
{
"imports": {
"#/*": "./src/*"
}
}
This suggests that when with { type: "json" } is present, the tsconfig.paths resolver may be bypassed and the specifier is instead passed directly to Node's native package-import resolution.
Expected
This should work without requiring a corresponding package.json#imports entry:
Activity
fix: resolve JSON modules with oxc-node's resolver
fix: resolve JSON modules with oxc-node's resolver (oxc-project#745)