Visual Studio Code and Webpack HMR (Hot Module Reload): Can It Work with ExB?

99
2
yesterday
DavidSolari
MVP Regular Contributor

I'm reaching the point of widget development where reloading and readding my custom widget for debugging is grinding my gears. The VSCode documentation suggests that webpack's HMR feature should just work for React, but they're using the default React toolchain, not whatever non-standard loadout the ExB team had to bolt together to get this all working. Has anyone had success getting HMR working? Is this even feasible with ExB's layout? In a perfect world I can hit save, wait for webpack to hot compile and then my next interaction with the debug browser instance pulls the hot-loaded code. At this point I'd settle for the hot-load only taking effect on remount.

0 Kudos
2 Replies
JeffreyThompson2
MVP Frequent Contributor

It's been a while since I've seen pure React, but I think the hot reloader works. I click save in Visual Studio and click the refresh button in the browser and I see the changes. Isn't that what the Webpack hotloader does?

GIS Developer
City of Arlington, Texas
0 Kudos
DavidSolari
MVP Regular Contributor

Webpack describes HMR on their official site as bypassing browser reloads entirely: you hit save, the page hotswaps the webpack chunks, now your webpage has the updated code ready to go, like "changing styles directly in the browser's dev tools." It also mentions this is something the "application" has to manage, which I assume is Experience Builder in this context, so we'd need someone with tons of internal ExB knowledge to weigh in on if this is feasible or not.

0 Kudos