-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Run a process on parcel watch rebuild #1131
Comments
See #800. There are also examples there on how to do this using the javascript api (also here in the docs). |
If it's a supershort command we could RFC this flag, but like mentioned in #800 this is a very niche use-case and is probably better served by the api |
Implementing this in code is fine. But for users who like to use parcel for node projects, like me, it would be nice to be 'configuration-free' and just be able to execute the node process as well: |
Yes, that makes sense, #800 is more about an additional build tool. See #935 (Parcel should run script differently with different targets):
|
Ah, then I will just subscribe to that issue and see what happens. For now, my implementation using the api is working fine, so thanks for your help! |
@NicolaiSchmid would love to see how you're running this. Have a usecase for a run on bundle finished. do you just run a js file that runs runBundle() ? eg: |
I'm not completely able to recall my specific requirements from April, but since then I have switched to a webpack solution using webpack-nodemon, which covers all my problems. |
@sebbean I just implemented a quick watcher using the
|
In the case of node development, it would very usefull to launch something after each build completes, but not necessarily the node script, we often need to launch jest tests too... so an --exec would be nice... |
Why close this issue ? |
I know this is old, but i do not understand why parcel does not have a simple argument, accepting a command which is run after the watcher did its build. Anyway this is my solution to the problem: "scripts": {
"build": "parcel build",
"dev": "concurrently npm:dev:build npm:dev:run",
"dev:build": "parcel watch",
"dev:run": "sleep 2 && nodemon --delay 2 --watch dist --exec npm run dev:start",
"dev:start": "node dist/index.cjs", |
Choose one: is this a 🐛 bug report or 🙋 feature request?
Feature request
I'm using parcel to build my backend nodejs code and it would be nice to integrate a nodemon-like feature into parcel.
Currently, I'm watching my files with parcel and it would very helpful to just specify a process that should be run after each build. Eg my freshly compiled script.
💁 Possible Solution
Maybe add an
--exec
flag to the watch command that runs the specified value as a process and restarts it after the build finishes.The text was updated successfully, but these errors were encountered: