How to fix ERR_UNKNOWN_FILE_EXTENSION in

Поделиться
HTML-код
  • Опубликовано: 15 июл 2024
  • In this TypeScript tutorial, we will explore different TypeScript loaders, including ts-node, tsx, and tsimp. We will also discuss the differences between loading CommonJS modules and ECMAScript modules in Node v18 and Node v20.
    My FREE programming apps:
    - apps.apple.com/app/id659282498
    - play.google.com/store/apps/de...
    My FREE TypeScript Course:
    - typescript.tv/
    Timeline:
    00:00 Introduction
    01:36 Syntax Error: Unexpected token
    02:44 Select TypeScript Version
    04:10 Using ts-node
    05:01 Showing node require
    05:50 ERR_UNKNOWN_FILE_EXTENSION and ts-node-esm
    07:16 ERR_UNKNOWN_FILE_EXTENSION with Node v20
    08:20 Showing node loader
    08:55 Deactivating experimental warnings
    10:00 Missing stack traces in Node v20 with ts-node
    12:20 Showing TypeScript Execute (tsx)
    13:30 Type checking with tsx
    14:58 TypeScript Import Loader (tsimp)
    17:00 Compilation Diagnostics
    19:10 Showing cross-env
    19:50 Note on development dependencies
  • НаукаНаука

Комментарии • 13

  • @TypeScriptTV
    @TypeScriptTV  5 месяцев назад

    If you want to run "ts-node" in production with ESM, then use: "tsc --noEmit && node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only src/main.ts" (see github.com/TypeStrong/ts-node/issues/104#issuecomment-1941702624)

  • @antonioquintero-felizzola5334
    @antonioquintero-felizzola5334 5 месяцев назад +1

    This is easily the most underrated TS channel on RUclips. Thank you for your videos Benny.

    • @TypeScriptTV
      @TypeScriptTV  5 месяцев назад

      Thank you! I also think the same. 😅 Btw. I made an app for programmers: apps.apple.com/app/id659282498

  • @humaitrix
    @humaitrix 3 месяца назад +1

    Thank you Benny! Amazing video, not only sharing the solution but explaining why it's the best solution available at the moment! Tks a lot

    • @TypeScriptTV
      @TypeScriptTV  3 месяца назад

      Thank you, Daniel! It's important for me to not only show the "how" but also explain the "why". I try to follow this principle in all my TypeScript tutorials. 😀

  • @leonardogonzalezrodriguez2290
    @leonardogonzalezrodriguez2290 3 месяца назад +1

    Thank you so much for your explanation, it helped me a lot

  • @damienbutt6320
    @damienbutt6320 4 месяца назад

    I’ve been using vite-node as my ts-node alternative. Seems to work really well out of the box with ESM. And nodmon etc. No issues.

    • @TypeScriptTV
      @TypeScriptTV  4 месяца назад

      Thanks for sharing this with us. Does it also show you stacktraces when using Node.js v20?

  • @seeyou7989
    @seeyou7989 4 месяца назад

    Thanks but what if i have to use nodemon

    • @TypeScriptTV
      @TypeScriptTV  4 месяца назад +1

      When using nodemon, you can create a "nodemon.json" file in your repository and use the commands in the "exec" section.

  • @sayandedotcom
    @sayandedotcom 4 месяца назад

    how to do it with nodemon "node --loader ts-node/esm && nodemon ./index.ts"

    • @TypeScriptTV
      @TypeScriptTV  12 дней назад

      Will you get type checking when doing this?