question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Hot Loader doesn't work if React is external (CDN)

See original GitHub issue

Hi there,

Given:

module.exports = {
  externals: {
    react: 'React',
    'react/addons': 'React',
    'react-router': 'ReactRouter'
  }, ...

and:

    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react-with-addons.min.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/react-router/0.11.6/react-router.min.js"></script>

in the html. Then the React Hot Loader doesn’t work. I see this in the console:

[HMR] Waiting for update signal from WDS...
[WDS] Hot Module Replacement enabled.
[WDS] App updated. Recompiling...
[WDS] App updated. Recompiling...
[WDS] App hot update...
[HMR] Checking for updates on the server...
[HMR] Updated modules:
[HMR]  - 20
[HMR] App is up to date.

but I don’t see the changes getting reflected in the view. It’d work however If I commented out the externals configuration and the script lines in the html (getting webpack to use NPM react packages).

The console output is almost the same as above except that [HMR] - 20 was [HMR] - 19.

Any suggestions on how to debug/fix this would be welcome. Confirmation that anyone has successfully used React Hot Loader with external React resources would be great too.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
codelegantcommented, Aug 4, 2016

@gaearon In product env, use externals, and the addons had to declare like this const update=React.addons.update. But in dev env, use NPM package, you should import update from 'react-addons-update. That made me confused, for consistency, I had to use externals in dev. Is there any solution? I’m waiting online. Thank you.

0reactions
gioacostaxcommented, Jan 11, 2016

@gaearon but now appears this; if I use ReactDOM to render (the correct way):

ERROR in ./~/react-dom/index.js /bower_components/react/react.min.js/lib/ReactDOM

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't make react-hot-loader and webpack-dev-server work ...
I'm trying to use react-hot-loader with webpack-dev-server and react-router , but when I try to access localhost:3000/ I get : Cannot GET /....
Read more >
file-loader - webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
react-hot-loader | Yarn - Package Manager
Troubleshooting. If it doesn't work, in 99% of cases it's a configuration issue. A missing option, a wrong path or port. webpack is...
Read more >
Getting Started · React Hot Loader - Dan gaearon
React Hot Loader is a plugin that allows React components to be live reloaded without the loss of state. It works with Webpack...
Read more >
Advanced Configuration - Create React App
Variable Development Production BROWSER ✓ Used 🚫 Ignored BROWSER_ARGS ✓ Used 🚫 Ignored HOST ✓ Used 🚫 Ignored
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found