preact-cli icon indicating copy to clipboard operation
preact-cli copied to clipboard

Watch mode without webpack's dev server

Open oliverstr opened this issue 4 years ago • 8 comments

Do you want to request a feature or report a bug? Feature

What is the current behaviour? When developing a custom server for SSR, the process of building the ssr-bundle is a very bad experience. The build command can take a long time and there's no watch mode, meaning every time there's a code change the developer needs to kill the server, build the entire application, and run the server again.

If the current behaviour is a bug, please provide the steps to reproduce.

What is the expected behaviour? build command could have a watch mode option

If this is a feature request, what is motivation or use case for changing the behaviour? This would greatly benefit developers that have custom servers and want a hot reload option.

Please mention other relevant information. I can create a PR for this.

Please paste the results of preact info here.

oliverstr avatar Jun 17 '20 16:06 oliverstr

As build is meant to create a production build (coming from the ReadMe), would it be better to instead add an option to the watch command in some capacity? Adding a watch feature to the build command would mean the entire production build/optimization process would be done on every change to the source, no?

Regardless, would be nice, I agree.

rschristian avatar Jun 17 '20 19:06 rschristian

As build is meant to create a production build (coming from the ReadMe), would it be better to instead add an option to the watch command in some capacity? Adding a watch feature to the build command would mean the entire production build/optimization process would be done on every change to the source, no?

Regardless, would be nice, I agree.

Makes total sense, was thinking of changing the env to development on the build command but I guess that will get messy.

Cool, should then add an option in the watch that will:

  • disable dev server
  • add watch mode to webpack
  • build the ssr-bundle

Wdyt?

oliverstr avatar Jun 18 '20 07:06 oliverstr

That certainly sounds great.

Granted, I have absolutely no idea how much work that would be to add as I haven't even glanced at the source for prerendering, but it sounds like it would be a much improved experience, no doubt.

rschristian avatar Jun 18 '20 16:06 rschristian

@RyanChristian4427 I've got the PR ready, how can I push a new branch to the repo?

oliverstr avatar Jun 25 '20 17:06 oliverstr

To this repo? Unless I'm mistaken, you can't merge a fork into a new branch on the fork's origin.

If you want to merge into a branch rather than master for some reason, you'll need one of the maintainers to add one for you.

rschristian avatar Jun 25 '20 17:06 rschristian

@RyanChristian4427 https://github.com/preactjs/preact-cli/pull/1264

oliverstr avatar Jun 29 '20 14:06 oliverstr

is there any progress...? this feature would be great.

gabrielrtakeda avatar Aug 03 '20 16:08 gabrielrtakeda

@gabrielrtakeda A PR has been made and it's roughly usable if you're interested in trying it. It's been pretty much untouched since being opened though.

rschristian avatar Aug 03 '20 17:08 rschristian