Git Product home page Git Product logo

Comments (6)

wesbos avatar wesbos commented on June 1, 2024

Also hitting this as well. In dev mode I have a malformed .tsx file and it causes the whole process to die. I was hoping to just catch the error and print the error and have it retry next run.

Perhaps nodemon might help here..

from tsx.

thelinuxlich avatar thelinuxlich commented on June 1, 2024

Maybe related? evanw/esbuild#577

from tsx.

broofa avatar broofa commented on June 1, 2024

Additional info: This issue does indeed kill the process, by the way. For example, if you add a setInterval to the top of load.mjs:

import module from 'node:module';

// Timer to keep the process allive
setInterval(() => console.log(Date.now()), 1000);

console.log('STARTING ...\n');

...

... you'll see the process exits under tsx before the timer even has a chance to fire. Whereas in node it will happily chug right along logging once/second.

from tsx.

wesbos avatar wesbos commented on June 1, 2024

Yep, node.js dynamic import or require can be caught, but tsx cannot.

try {
  const x = await import(`./file-with-syntax-error.js`);
  console.log(x);
} catch (e) {
  console.log(`caught error in try/catch block`);
  console.error(e);
}

Change the .js file with a .ts and you'll see the issue.

Right now my whole dev experience breaks with a syntax error and I have to a non-ignored file and save it to restart the process.

from tsx.

privatenumber avatar privatenumber commented on June 1, 2024

Fixed in https://github.com/pvtnbr/tsx/pull/7

from tsx.

privatenumber avatar privatenumber commented on June 1, 2024

Released in https://github.com/privatenumber/tsx/releases/tag/v4.8.1

from tsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.