bazel-javascript
bazel-javascript copied to clipboard
Does hot reloading push?
I don't quite understand how you do hot reloading. When I use webpack with purescript and I change my code, webpack will recompile the code and then push the changes over a websocket to page I have open. If you use ibazel
surely this is not possible? Wouldn't it restart the server every time?
Or do you have 2 processes running at the same time (in 2 terminals), ibazel
to recompile the code and then a webpack sever that watches the result of that?
Hi David, the key mechanism is a special tag added here which ensures that the webpack dev server does not get killed. Instead it watches the transpiled directory (see this script, sorry it's a bit hard to follow!).
There are indeed two processes running at the same time, but in a single terminal as ibazel
takes care of them:
-
ibazel run ..._server
will build all dependencies and start running Webpack dev server - on code changes,
ibazel
does not kill Webpack dev server (because of the special tags mentioned above) but does rebuild all dependencies, which Webpack dev server notices because it has hot reloading enabled.
Does that somewhat make sense?
oh, the tags, cool thanks
Does this in theory work with any other rule that produces javascript? Is there a type of provider that my rule would need to use to work with this? At the moment my fork of rules_purescript produces many javascript files but it could be bundled into a single file using another layer of bundling which would produce a single javascript file to provide to your bundler. Would this make sense? Can your bundler already deal with a rule that produces many javascript files?
I tried to use rules_rollup but it seemed it couldn't handle my results.
That's a good question. These rules weren't designed with this kind of usage in mind, but we might be able to tweak it to allow that. I think @enriched had some ideas about this too.
It'd be helpful if you had a very small example with rules_rollup
that we could debug from.