Closed rijkvanzanten closed 5 months ago
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
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
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 🙂
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 withnode dist/index.mjs
which does start theh3
/listhen
powered server, but doesn't restart it when the file change (so it doesn't watch). Usingnode
's native--watch
doesn't work either, asjiti
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
(egnodemon --watch src dist/index.mjs
), but I'm very curious to learn how this is supposed to work 🙂Additional information