running node filename with typescript files gives module not found error

I have file1.js which imports file2.ts. But when I run node file1.js I get an error

Cannot find module “/path to file2” imported in “file1”

I have even tried converting file1.js to file1.ts, but then I get –

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension “.ts”

This is my tsconfig.json –

{
"compilerOptions": {
    "target": "ES2020",
    "useDefineForClassFields": true,
    "module": "ESNext",
    "lib": ["ES2020", "DOM", "DOM.Iterable"],
    "skipLibCheck": true,

    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "preserve",
    "jsxImportSource": "solid-js",

    /* Linting */
    "strict": true,
    "allowJs": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,
    "baseUrl": "src"
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}

I have even tried adding esm:true to the tsconfig, but still no solution-

 "ts-node": {
    "esm": true
  }

Please help find a solution.