-
Notifications
You must be signed in to change notification settings - Fork 14
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
Investigate hot module replacement and live reloading for fast iteration #845
Comments
A duplicate issue, #864, was closed. Content from that issue: @jonathanolson said: For es6 modules, it would be good to see if webpack-dev-server can create faster iteration times.
@chrisklus said: start off by looking at webpack.config.js, deleted in 1d3ab17. |
I'm going to probably restore that file in my investigation (one of the things I plan to look into today) |
@samreid and I found that the After some research, we found that we could allow this by having the ip address be Further reading: webpack/webpack-dev-server#147 Can we commit something like: Index: js/grunt/webpackDevServer.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- js/grunt/webpackDevServer.js (revision 328924a37ab3d5450f3e3ee4db047b27fe7d61e0)
+++ js/grunt/webpackDevServer.js (date 1582921761755)
@@ -109,7 +109,8 @@
hot: true
} );
- server.listen( port, '127.0.0.1', () => {
+ // '0.0.0.0' allows other network traffic to access this server
+ server.listen( port, '0.0.0.0', () => {
repos.forEach( repo => console.log( `http://localhost:${port}/dist/${repo}_phet.html?brand=phet&ea` ) );
- });
+ } );
};
If there are worries, perhaps we can make it an option? |
Sounds good to me, committed above. |
In the commit, I added a command line option for devtool. I'm currently using
for faster iteration times. @jonathanolson can you please review? |
Reviewed the first commit, looks good. How is the hot module replacement going? I had to comment it out yesterday because I kept getting errors on launch. |
The latter 2 commits should help with that. The problem was that unbuilt: webpack-dev-server I added isHMR to help with that. I used HMR to work on Greenhouse Effect views and Wave Interference sonification and it worked really well. It was nice to be able to hear the audio change as I saved from the IDE, without having to reload or reconfigure the sim. |
I realized I accidentally just committed hot:false, and reverted it. I'll test it out, that sounds really nice! Do you have an example of adding it into code? Would like to try it for density/buoyancy. |
I used it in https://github.com/phetsims/greenhouse-effect/blob/82a73ba2a81f90f31cc7d001b6c13a54a7be4ab2/js/waves/GreenhouseWavesScreenView.js#L26 and haven't yet committed the usage in Wave Interference. |
I also committed a usage in Wave Interference |
Discussed in the 6/4/2020 dev meeting, and @samreid will make some updates on this and close it. |
Documented, closing. |
From #820, using ES6 modules we can use the following iteration features:
For this investigation, we should look into webpack-dev-server and parcel for both live reload and hot module replacement.
The goal is to optimize our iteration time while minimizing overhead.
My initial investigation into hot module replacement in webpack works like so:
npx webpack-dev-server
The text was updated successfully, but these errors were encountered: