Open
Description
So that we can run code in node after a basic npx tsc
, without module compatibility problems
cc @martin-gorner for viz
Later we can investigate other steps needed to debug a local file, until we reduce it to the minimal amount
Metadata
Metadata
Assignees
Labels
No labels
Activity
martin-gorner commentedon Oct 30, 2024
source: Node v18+ docs: https://nodejs.org/api/esm.html#mandatory-file-extensions
"Mandatory file extensions
A file extension must be provided when using the import keyword to resolve relative or absolute specifiers. Directory indexes (e.g. './startup/index.js') must also be fully specified."
martin-gorner commentedon Oct 30, 2024
I also noticed we use import statements without an extension throughout the codebase, in huggingface.js and internal projects as well. Maybe there is a rationale for that. If so, node can be made to work with extensionless imports using the "extensionless" package:
npm install extensionless
and thennode --import=extensionless/register test.js
✨ Switch to nodenext resolution (#1026)
julien-c commentedon Feb 5, 2025
can close?
coyotte508 commentedon Feb 6, 2025
We only did it for tasks, ideally we do it for all modules I think
julien-c commentedon May 23, 2025
Ok, lets go copilot
.js
#1491coyotte508 commentedon May 24, 2025
actually with TS 5.7 it may not be needed : https://devblogs.microsoft.com/typescript/announcing-typescript-5-7/#path-rewriting-for-relative-paths
🤔
I'll analyze the diff and prepare a commit message.