isomorphic-flux-boilerplate icon indicating copy to clipboard operation
isomorphic-flux-boilerplate copied to clipboard

HMR doesn't work for npm linked modules

Open ramivalta opened this issue 9 years ago • 3 comments

Hot module replacement doesn't seem to be working when using npm link. Webpack correctly notices there are changed files and rebuilds the bundle, and browser console shows what files have changed and seemingly updates the correct modules, but the browser doesn't get the updated code until the app is restarted (with rs).

Example:

> ls -l node_modules/linked-module
lrwxr-xr-x  1 rtv  staff  55 Feb  2 12:29 node_modules/linked-module -> /usr/local/lib/node_modules/linked-module

Edits file called WantContainer.js in linked-module

webpack: bundle is now INVALID.
webpack building...
  dev `webpack-stats.json` updated +8m
webpack built e76a69b94a58a2dca12a in 3512ms
chunk    {0} app-e76a69b94a58a2dca12a.js, 0.8b55b2e8e63fe3633838.hot-update.js, app-e76a69b94a58a2dca12a.js.map, 0.8b55b2e8e63fe3633838.hot-update.js.map (app) 16.9 MB [rendered]
chunk    {1} 1-e76a69b94a58a2dca12a.js, 1-59aeefde317b1b1f99d7.js, 1-59aeefde317b1b1f99d7.js.map 187 kB {0}
chunk    {2} 2-e76a69b94a58a2dca12a.js, 2-59aeefde317b1b1f99d7.js, 2-59aeefde317b1b1f99d7.js.map 62 kB {0}

process-update.js:27 [HMR] Checking for updates on the server...
2016-02-02 13:44:26.967 index.js:81 [React Transform HMR] Patching Root
2016-02-02 13:44:26.970 index.js:81 [React Transform HMR] Patching RootContainerComponent
2016-02-02 13:44:26.971 process-update.js:80 [HMR] Updated modules:
2016-02-02 13:44:26.972 process-update.js:82 [HMR]  - ../serviceBrowser/lib/product/WantContainer.js
2016-02-02 13:44:26.972 process-update.js:82 [HMR]  - ../serviceBrowser/lib/index.js
2016-02-02 13:44:26.972 process-update.js:82 [HMR]  - ../serviceBrowser/lib/index.js
2016-02-02 13:44:26.973 process-update.js:82 [HMR]  - ./src/Routes.jsx
2016-02-02 13:44:26.973 process-update.js:82 [HMR]  - ./src/universal-render.jsx
2016-02-02 13:44:26.973 process-update.js:82 [HMR]  - ../serviceBrowser/lib/product/LikeContainer.js
2016-02-02 13:44:26.973 process-update.js:82 [HMR]  - ../serviceBrowser/lib/product/NeedContainer.js
2016-02-02 13:44:26.974 process-update.js:82 [HMR]  - ../serviceBrowser/lib/product/PlanGrid.js
2016-02-02 13:44:26.974 process-update.js:82 [HMR]  - ../serviceBrowser/lib/product/ProductContainer.js
2016-02-02 13:44:26.974 process-update.js:82 [HMR]  - ../serviceBrowser/lib/product/ProductWrapper.js
2016-02-02 13:44:26.974 process-update.js:82 [HMR]  - ../serviceBrowser/lib/product/SummaryContainer.js
2016-02-02 13:44:26.974 process-update.js:82 [HMR]  - ../serviceBrowser/lib/wizard/WizardContainer.js
2016-02-02 13:44:26.975 process-update.js:82 [HMR]  - ../serviceBrowser/lib/ServiceContainer.js
2016-02-02 13:44:26.975 process-update.js:87 [HMR] App is up to date.



Yet the browser doesn't get the updated code.

ramivalta avatar Feb 02 '16 11:02 ramivalta

Hello @tiil this is a known webpack issue with symlinked directories, it will be fixed in version 2 :+1:

iam4x avatar Feb 02 '16 12:02 iam4x

Thanks @iam4x, time to upgrade I guess.

ramivalta avatar Feb 02 '16 13:02 ramivalta

@iam4x Version 2 of webpack? Any details on what this fix is?

Relequestual avatar Feb 13 '17 15:02 Relequestual