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

Document "passive watcher" usage #265

Closed
1 task done
rijkvanzanten opened this issue May 15, 2023 · 4 comments
Closed
1 task done

Document "passive watcher" usage #265

rijkvanzanten opened this issue May 15, 2023 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@rijkvanzanten
Copy link

Describe the feature

Hi there! I've been very interested in trying out the recommended "Passive Watcher" alternative to watching. I was able to find the hidden unbuild --stub command through the issues, but don't know what the next step is supposed to be. I've tried running the output with node dist/index.mjs which does start the h3/listhen powered server, but doesn't restart it when the file change (so it doesn't watch). Using node's native --watch doesn't work either, as jiti doesn't use an "import", so Node's watcher doesn't recognize the file change.

I should be able to make it work with nodemon (eg nodemon --watch src dist/index.mjs), but I'm very curious to learn how this is supposed to work 🙂

Additional information

  • Would you be willing to help implement this feature?
@rijkvanzanten
Copy link
Author

rijkvanzanten commented May 15, 2023

Here's what I'm currently landing on using. Curious to hear your thoughts! If this is the recommended approach, I'm more than happy to open a PR to tweak the docs 👍🏻

	"scripts": {
		"build": "unbuild",
		"start": "node dist/index.mjs",
		"stub": "unbuild --stub",
		"dev": "node --watch-path=src dist/index.mjs"
	},

To run in production, run npm run build followed by npm start. For dev server usage, run npm run stub and npm run dev. Note: I was having some issues with --watch-path in Node 18. I've upgraded to v20 which seems to resolve those issues

@so1ve
Copy link

so1ve commented May 16, 2023

The stub mode means you don't have to build everytime once you changed the code. If you want to build it instantly, try to use privatenumber/pkgroll

@rijkvanzanten
Copy link
Author

The stub mode means you don't have to build everytime once you changed the code. If you want to build it instantly, try to use privatenumber/pkgroll

Yeah! Though if that is all it's intended to do, I think the name "Watcher" is a tad misleading, as it doesn't "watch" like you'd expect from a --watch flag in other CLI tools 🙂

@pi0 pi0 mentioned this issue Jul 18, 2023
5 tasks
@pi0 pi0 added the documentation Improvements or additions to documentation label Jul 18, 2023
@Barbapapazes Barbapapazes self-assigned this Feb 18, 2024
@pi0 pi0 mentioned this issue Jun 4, 2024
5 tasks
@pi0
Copy link
Member

pi0 commented Jun 4, 2024

@pi0 pi0 closed this as completed Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants