Currently, when you run parcel with --target set to node, it starts a static dev server on port :1234. This doesn't really make sense for Node bundling, since we don't expect the code to run in the browser.
Is anybody opposed to disabling the dev server for node bundling?
This is definitely not very usefull, might be a good idea to add in a check to prevent this, no need to start servers for no reason
I can take a look.
Question, should I change the serve command, or should I change the default command to build when --target set to node ?
@lili21 Node.js should just watch and auto-recompile when doing anything but build imo.
It shouldn't startup the server but simply watch and rebuild changed assets
@DeMoorJasper Actually, maybe we should just not start the dev server for ANY non-html entry points, regardless of the target.
So if I run parcel index.js even without --target node, there's still no point in starting a dev server for a JS file (as far as I see)
@davidnagli that鈥檚 actually a good point, as far as I know you鈥檙e right
Sent with GitHawk
~I don't know really much about HMR, but should it be disabled too?~ Sry, I see it is already disabled on node targets.
Hi, after a lot of trial and error I found this issue here.
The below worked till 1.7.1 but with the next release of 1.8.0 it didn't (incl the current 1.9.7). Reason, the dev server did not get launched anymore for the parcel:launch command.
"start": "run-p -r parcel:launch electron:launch",
"parcel:launch": "parcel src/renderer/index.html -p 1124 -d dist/renderer/development --target=electron",
"electron:launch": "run-s parcel:main electron:start",
"parcel:main": "parcel build src/main/main.ts -d dist/main --out-file=main --target=electron",
"electron:start": "electron ."
I am not familiar about all the internals of Parcel but, should the patch not be more like:
if (command.name() === 'serve' && (command.target === 'browser' || command.target === 'electron')) { ...
With that modification it works as expected.
Is the possible solution of @rkpatel33 (btw. thanks for those documented trial and error cases. It made me feel not alone!) to make use of the API the only way now? It seems a bit bloated for something what could be a single command?
Most helpful comment
@davidnagli that鈥檚 actually a good point, as far as I know you鈥檙e right
Sent with GitHawk