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

Dev server with the "dumb" hot reloading #92

Open
zindel opened this issue Jul 9, 2018 · 17 comments
Open

Dev server with the "dumb" hot reloading #92

zindel opened this issue Jul 9, 2018 · 17 comments

Comments

@zindel
Copy link
Member

zindel commented Jul 9, 2018

I've started the refactor this weekend with the main goal to provide the accurate and machine-friendly reporting using the --report=json option. If you're curious see the refactor/flat-packer branch. In fact this is just the beginning of it. I'm also planning to optimize and re-structure the production mode bundling (tree-shaking), but that'd take another week or two.

In this issue I wanted to start the discussion and ask for some help implementing the integration with the dev server. I am not really experienced with the Node-based backend development, so any feedback or prototyping is much appreciated.

The server may work as following:

  1. Accept few basic options required for running (--host, --port, etc) + all the fastpack original options (except maybe --development which is always set and --report which is always set to json).
  2. Start the fpack process in a watch mode with the provided options and capture its stdout/stderr.
  3. Start the web socket server and inject the websocket client code to any html file served.
  4. On receiving the "ok" event from fpack ping clients and ask them to simply reload the page.
  5. On receiving the "error" event - send the error to clients. They will have to show it in the browser.

Thank you!

@TrySound TrySound self-assigned this Jul 9, 2018
@rauanmayemir
Copy link

I'm currently working on a small react app and using webpack's dev server with hot reloading. Would love to give pointers and help with testing. (will try to contribute as well, but I'm a bit stretched these days).

@TrySound
Copy link
Member

TrySound commented Jul 9, 2018

@rauanmayemir Thanks. I will ping you when it will be ready for testing.

@matthiaskern
Copy link

I could help with testing on another react app which has cra-like setup. Would also be interested in directly contributing if there are any low-hanging fruits.

@shellscape
Copy link

shellscape commented Jul 9, 2018

Former maintainer of webpack-dev-server, and current maintainer of webpack-serve, webpack-hot-client, webpack-dev-middleware (...the list goes on). I'd be happy to help get a dev server going for you all (that is of course, if it was cool if JavaScript was used - I'm afraid I'm not a ReasonML dev)

@zindel
Copy link
Member Author

zindel commented Jul 9, 2018

@shellscape Thanks for offering the help! Mind if we ask you to review & provide feedback on the @TrySound's initial implementation? And yes, we plan to use JavaScript for it

@shellscape
Copy link

@zindel absolutely, can you point me in a direction towards it?

@zindel
Copy link
Member Author

zindel commented Jul 9, 2018

@shellscape will do once @TrySound has something ready :) @TrySound do you mind if we keep it in one repo/npm package for now? We can place it in node-service/ if you don't mind.

@TrySound
Copy link
Member

TrySound commented Jul 9, 2018

@zindel I thought about providing apis like this

import { build, serve } from 'fpack';

build({
  // options
})

serve({
  // options
})

@zindel
Copy link
Member Author

zindel commented Jul 10, 2018

@TrySound maybe we can postpone creating the JS API for now? I think the fpack API may change significantly and JS API will go out of sync. I think the ideal solution would be to blindly pass the remaining command-line options to the fpack binary and let it do its job. Some knowledge is obviously needed though:

  • always pass --report=json
  • always pass -w
  • always pass --development

Everything else may go as is. Thoughts?

@andreypopp
Copy link
Collaborator

andreypopp commented Jul 10, 2018 via email

@zindel
Copy link
Member Author

zindel commented Jul 10, 2018

We have agreed on just serve for now which is not going to be public (yet).

@TrySound
Copy link
Member

Guys, I'm busy these days. It's better to somebody else take this issue. @shellscape would be great to have your experience in this.

@TrySound TrySound removed their assignment Jul 19, 2018
@ulrikstrid
Copy link
Contributor

I hacked this together: https://github.com/ulrikstrid/fpack-dev-server

I should take a look at what @shellscape has done in the various webpack-dev-server packages to make it more robust etc but this is a really simple start.

@shellscape
Copy link

webpack-serve and webpack-hot-client are the two to check out. webpack-dev-server is a tire fire.

@ulrikstrid
Copy link
Contributor

@shellscape if you want to take this feel free. If you don't I'll slowly continue.

Thanks for the pointers!

@shellscape
Copy link

It'll be a few weeks for me (offline is crazy right now, including an inoperable thumb of all things), but I'll star your repo and see about where I can help your effort when I'm able.

@ulrikstrid
Copy link
Contributor

There is an open PR but I also have this playground repo that I've been toying with if anyone is interested to have a look https://github.com/ulrikstrid/fastpack-devserver-playground.

It basically works but I need to add more inputs with cmdliner and also have a real implementation of a websocket client that gets injected into the html or something like it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants