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.

Webpack Hot Dev Client Breaks on older browsers

See original GitHub issue

Is this a bug report?

yes

Did you try recovering your dependencies?

no

Which terms did you search for in User Guide?

hot dev

Environment

System: OS: macOS High Sierra 10.13.6 CPU: x64 Intel® Core™ i7-6820HQ CPU @ 2.70GHz Binaries: Node: 8.12.0 - /usr/local/opt/node@8/bin/node Yarn: 1.10.1 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/opt/node@8/bin/npm Browsers: Chrome: 69.0.3497.100 Safari: 12.0 npmPackages: react: ^16.5.2 => 16.5.2 react-dom: ^16.5.2 => 16.5.2 react-scripts: 2.0.4 => 2.0.4 npmGlobalPackages: create-react-app: 2.0.0-next.2150693d

Steps to Reproduce

(Write your steps here:)

  1. npx create-react-app my-app
  2. cd my-app
  3. yarn start
  4. Navigate to app url in old browser that does not have map. E.g. Android 4.4 default browser or ie9 (I used Android 4.4)

Expected Behavior

Default Screen Loads

Actual Behavior

Blank Screen, connecting the debugger reveals the console error Map is not defined

This is caused by a Map call from ansi-styles which is required by chalk.

screen shot 2018-10-07 at 02 00 09

To get past this I added require('react-app-polyfill/ie9'); to the top of webpackHotDevClient (Delete the babel loader cache if you do this). This gets further but then failes on setPrototypeOf. Using the catch all require('core-js'); allows the app to work as expected.

screen shot 2018-10-07 at 02 02 21

Note: the yarn build version always works because the hot dev client is not present

I am not sure if this is something CRA actually wants to support, I think some documentation that the dev mode yarn start may not work with older browsers will be enough.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:44 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
lomocccommented, Nov 29, 2018

I found the dependencies cause the bug

create-react-app -> react-scripts/config/webpack.config.js -> react-dev-utils/webpackHotDevClient.js -> react-dev-utils/formatWebpackMessages.js -> chalk -> ansi-styles -> Map

and I think we need setupPolyfill ( just like setupProxy),it should be insert before webpackHotDevClient:

entry: [
  paths.setupPolyfill,
  isEnvDevelopment &&
  require.resolve('react-dev-utils/webpackHotDevClient'),
  // Finally, this is your app's code:
  paths.appIndexJs,
]
10reactions
miraagecommented, Oct 29, 2018

@cliedeman do you have import 'react-app-polyfill/ie9'; as the very first line of src/index.js?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Webpack Hot Dev Client Breaks on older browsers -
Coming soon: A brand new website interface for an even better experience!
Read more >
Hot Module Replacement - webpack
This guide extends on code examples found in the Development guide. Hot Module Replacement (or HMR) is one of the most useful features...
Read more >
Webpack build failing with ERR_OSSL_EVP_UNSUPPORTED
If you're using an older version of Webpack, you can still solve this by changing the hash function to one that is not...
Read more >
The best webpack configurations for React applications
open: if true, opens our app in the browser. Now every time we run $ npm run dev , our app will open...
Read more >
How to Upgrade to React 18
Updates to Client Rendering APIs. When you first install React 18, you will see a warning in the console: ReactDOM.render is no longer...
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