Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch mode not working on v8.3.4 / v8.3.5 #1245

Open
paulcjy opened this issue Oct 29, 2024 · 11 comments · May be fixed by #1256 or #1253
Open

Watch mode not working on v8.3.4 / v8.3.5 #1245

paulcjy opened this issue Oct 29, 2024 · 11 comments · May be fixed by #1256 or #1253

Comments

@paulcjy
Copy link

paulcjy commented Oct 29, 2024

It works until v8.3.0 but doesn't work on next releases v8.3.4 and v8.3.5.

v.8.3.0

There are two lines at the bottom and watch mode works well.

CLI Watching for changes in "."
CLI Ignoring changes in "**/{.git,node_modules}/**" | "dist"
image

v8.3.4 / v8.3.5

No messages for watch mode and watch mode doesn't work as well.

image

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@paulcjy paulcjy changed the title Watch mode not working on v8.3.5 Watch mode not working on v8.3.4 / v8.3.5 Oct 29, 2024
@ghiscoding
Copy link

ghiscoding commented Nov 2, 2024

it might be, due to recent upgrade of Chokidar to v4 in PR #1211. Perhaps the new glob (from tinyglobby) should add the { dot: true } option? cc @SuperchupuDev

@SuperchupuDev
Copy link
Contributor

could be, would have to check how chokidar v3 did globbing

@r-rayns
Copy link

r-rayns commented Nov 14, 2024

I'm having the same issue. I had version 8.3.5 installed in a project which was running Express.

When I run the project I do not see the typical watch mode message, which looks something like:

CLI Watching for changes in "."
CLI Ignoring changes in "**/{.git,node_modules}/**" | "dist"

The project does not reload on changes.

However! If I stop my Express server from running:

// stop express server from running
// server.listen(8080, () => console.log('Server is live'))

Removing this line of code and restarting my app, I see the expected watch mode message and my project does reload on changes.

Downgrading to 8.3.0 works whether my Express server is running or not. So that is what I've done for now.
Hope this extra bit of information helps!

@methompson
Copy link

I'm encountering the same issue, but it seems the onSuccess CLI option is what's causing the problem.

When I run npx tsup ./src/main.ts --watch from the terminal, I get the line CLI Watching for changes in "." and a compile event occurs on every save. Whereas, if I run npx tsup ./src/main.ts --watch --onsuccess="node dist/main.js", it doesn't have the watching changes line and does nothing further on save.

@methompson
Copy link

I've reviewed the source and I think I've found the cause. I added a bunch of log statements to the JS files in the node_modules dist folder and I found that there's a point where the code no longer progresses.

I'm pretty sure it's related to this line: https://github.com/egoist/tsup/blame/cd03e1e00ec2bd6676ae1837cbc7e618ab6a2362/src/index.ts#L357

Which, ultimately was updated with this PR which lines up with the timeframe for the last 2 versions not working correctly: 4dd5bfe

If I comment this line out in my dist folder (which, unfortunately, is elsewhere, because it's been transpiled), watch runs as normal.

I will provide a PR soon as a band-aid solution. Even if it's NOT the solution, it would behoove us to figure out what that goal is for the await statement, considering it breaks the functionality as listed in the documentation

@methompson
Copy link

PR: #1253

@laat laat linked a pull request Nov 28, 2024 that will close this issue
@SupertigerDev
Copy link

SupertigerDev commented Nov 30, 2024

almost a month with no fix 😭 is there a better tsup alternative?

@methompson
Copy link

almost a month with no fix 😭 is there a better tsup alternative?

Just use Esbuild. Tsup is just a wrapper around it.

@SupertigerDev
Copy link

almost a month with no fix 😭 is there a better tsup alternative?

Just use Esbuild. Tsup is just a wrapper around it.

Oh wow, I didn't know that. Thanks!

@methompson methompson linked a pull request Dec 2, 2024 that will close this issue
@methompson
Copy link

@ocavue Any chance we can get some eyes on the PR above?

@panoply
Copy link
Contributor

panoply commented Dec 20, 2024

Yeah, this issue is major headache. Personally, I'd like to see chokidar swapped out for https://github.com/parcel-bundler/watcher. Chokidar v4 has been a hassle.

Just use Esbuild. Tsup is just a wrapper around it.

Not really. tsup does post-processing similarly to vite, wherein treeshaking is performed by rollup and swc exists at some-point. There are also various features that help alleviate pain-points when writing modern tooling, esp node tooling. (see #806 for more on that).

I'll have a look at a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants