How to fix ERR_UNKNOWN_FILE_EXTENSION in

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024
  • НаукаНаука

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

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

    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)

  • @humaitrix
    @humaitrix 8 месяцев назад +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  8 месяцев назад

      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. 😀

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

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

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

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

  • @tonyg_nerd
    @tonyg_nerd Месяц назад

    😮 Mouth fell open watching this. There's no way that today's copy/paste developers are going to create quality software with scenarios like this.
    I've been doing this for decades, have been following advice for all of these various tools, to solve these problems, and had no clue about the details that you provided here. OMG - Thank you!
    I need to change my approach to this tooling ... maybe go back to BASIC. 😂

  • @MonsterSmart
    @MonsterSmart Месяц назад

    Great video. That was the last thing I couldn't figure out in my ts node setup

  • @HemantKumar-yk2jk
    @HemantKumar-yk2jk Месяц назад

    Excellent videos .. one of the best videos in TS

    • @TypeScriptTV
      @TypeScriptTV  Месяц назад

      Thank you! It's also reported that using "vite-node src/main.ts" is a viable option.

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

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

  • @mahdiahmadi504
    @mahdiahmadi504 23 часа назад

    Thanks for your comprehensive video! I was struggling with those errors for 5 hours before finding a solution. I tried tsx and noticed that while it’s fast, it lacks type checking. Finally, I ended up using the command:
    nodemon --exec node --loader ts-node/esm src/index.ts
    This setup does perform type checking. For example, if you write let x: string = 20, nodemon crashes the app with an error. However, I noticed that, like node with ts-node/esm, it doesn’t provide a stack trace for errors. Do you have any suggestion?

    • @TypeScriptTV
      @TypeScriptTV  45 минут назад

      Hi @mahdiahmadi504, to get stack traces, you can use tsimp (14:58) or run tsc --noEmit before executing ts-node-esm, as shown here: typescript.tv/hands-on/write-a-simple-typescript-script-with-esm/#fixing-err_unknown_file_extension

  • @HemantKumar-yk2jk
    @HemantKumar-yk2jk Месяц назад

    can we run this main.ts directly in the aws lambda or do we need to convert to js ?? i am not sure how can we use this for aws lambda ??

    • @TypeScriptTV
      @TypeScriptTV  Месяц назад

      To use your TypeScript code with AWS Lambda, you need to convert it to JavaScript: docs.aws.amazon.com/lambda/latest/dg/lambda-typescript.html

  • @evlbon
    @evlbon 2 месяца назад

    Its so stupid that ts-node --esm is not working with node v20+

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

    Thanks but what if i have to use nodemon

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

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

    • @evlbon
      @evlbon 2 месяца назад

      can be
      nodemon --exec node --loader ts-node/esm index.ts

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

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

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

      Will you get type checking when doing this?

    • @evlbon
      @evlbon 2 месяца назад

      I think u mean smt like this
      nodemon --exec node --loader ts-node/esm index.ts