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
add support for HMR #5013
add support for HMR #5013
Conversation
Are the un-covered lines in |
No, I don't think so. I think the reason they're not being executed now is because I've added an additional check for I found it annoying to have to disable |
With this, TinyMCE is now being bundled with Webpack directly, instead of us specifying the file manually in the config file. This means two things -
The comments in Regardless, dynamic imports work as expected now. |
Cool! The On my computer, it takes about two seconds to compile a change, and about three seconds total before the changed module re-renders. This feels a bit slow. Do you know why it takes 2 seconds to compile a trivial change to a single file? |
Did you try |
Do you think there's a good reason to leave linting enabled by default for Seems like it needs to warm up with a few recompiles when linting is disabled, but it gets the compile time down to about half a second, which makes HMR a lot more fun to use. |
Not really. Linting is enabled for |
yeah, I think disabling it for |
Couple of changes:
|
This test currently does nothing useful since it passes despite several 404 errors.
Addresses #5003 and #5005
This PR attempts to add support for HMR along with in memory mode for Webpack.
It sets up a proxy so that all requests to Rails under
/assets
are forwarded to the Webpack dev server. The dev server holds these files in memory instead of writing them to the disk - which should make things a bit faster.I've also had to split up
app.jsx
into multiple parts to ensure that the Redux store remains persistent across hot reloads.There are still some issues - for example, pages which load TinyMCE will not be hot reloaded - but for the most part, HMR should work as expected.TinyMCE should no longer causes any issues. See below for details.How to Enable
To enable it, make sure your
application.yml
has the following options setAfter that, you can run either
yarn hot
oryarn hot:no-lint
to start the dev server. Then start the Rails server as usual.Now you can edit the React code and have it reflected in the browser without needing a refresh. The progress(and any errors) can be viewed in the browser console.
If the code results in an error(runtime or compile time), its shown in the browser as an overlay.
Across these "refreshes", the Redux state stays persistent. However, if you edit one of the reducer files, the page will hard reload.