-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Webpack Hot Dev Client Breaks on older browsers #5336
Comments
CRA doesn't support old browsers anymore by default. https://reactjs.org/blog/2018/10/01/create-react-app-v2.html#breaking-changes |
But I still expected it to work after adding the opt in polyfills |
Try to use the latest of CRA. I see that you using a next branch, not sure if it's up to date or not... |
@cliedeman do you have |
I found the dependencies cause the bug
and I think we need entry: [
paths.setupPolyfill,
isEnvDevelopment &&
require.resolve('react-dev-utils/webpackHotDevClient'),
// Finally, this is your app's code:
paths.appIndexJs,
] |
Having the same issue trying to debug my app on IOS 7 safari. |
My temp solution, put this in public/index.html <% if (process.env.NODE_ENV === 'development') { %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.5/es6-sham.min.js"></script>
<% } %> https://gist.github.com/lomocc/a73ec03d7d01a319098ee90165f74c24 |
Thanks to @lomocc comment, I sorted it out that way: I added a entry: [
paths.setupPolyfill,
isEnvDevelopment &&
require.resolve('react-dev-utils/webpackHotDevClient'),
// Finally, this is your app's code:
paths.appIndexJs,
] and then in the module.exports = {
// ... all the exports
appNodeModules: resolveApp('node_modules'),
setupPolyfill: resolveApp('node_modules/react-app-polyfill/ie9'), // added
}; I also needed the <% if (process.env.NODE_ENV === 'development') { %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.5/es6-sham.min.js"></script>
<% } %> |
Solution in my caseThanks to @lomocc and @arnaudambro for their work on this. If you want to get the dev build working without altering <% if (process.env.NODE_ENV === 'development') { %>
<script src="https://polyfill.io/v3/polyfill.min.js?features=Map%2CSet%2CObject.setPrototypeOf"></script>
<% } %> Note that I'm not using DetailsHow I determined which features were missingI was specifically trying to enable an app to run in Opera 12.16, which I initially found lacked Polyfill redundancy in dev modeIf you're polyfilling anything from |
IE 10 Compatibility.NET Core / React / ReduxI just spent a few hours making my .NET Core / React app compatible with IE 10. Here is my solution until this is fixed in create-react-app. The above comments did not discuss MutationObserver, which is what caused me issues after ejecting and changing the order of dependencies.
|
@seanbecker15 Just to mention that you can avoid ejecting by using |
Do you mind adding how? |
You do NOT have to eject from CRA. Example: https://github.com/ThekhoN/create-react-app-ie11 Steps:
|
@ThekhoN Your solution doesnt work for me. Clone your repo. it gives me following error with blank page on IE11.
|
@activebiz can u try again. There seems to be some caching issue happening at IE11's end. |
@ThekhoN |
@kareemali-afs, a couple of observations:
"scripts": {
"start": "react-app-rewired start", |
You're probably right that it's because |
@kareemali-afs - I published the repo with the craco config I made for @rjcnd105, take a look at the changes I've made. It works for the very old, embedded browser I use (same WebKit engine as PhantomJS 2.1 uses, with capabilities similar to Safari 6). I attempted to add IE 11 support, however, I did not test it (don't have an environment for it). Give it a try :) |
@kareemali-afs
"scripts": {
"start": "react-app-rewired start",
"start:debug": "DEBUG_MODE=true react-app-rewired start",
const {
override,
babelInclude,
} = require('customize-cra');
const path = require('path');
module.exports = override(
(config) => {
if (process.env.DEBUG_MODE) {
config.entry.shift(); // remove webpackHotDevClient (first as default)
config.entry.unshift(require.resolve('react-app-polyfill/stable'));
}
return config;
},
babelInclude([path.resolve('src')])
); |
Create a new create-react-app, add react-app-polyfill, update index.js to include the pollyfills, update browserlist to have ie 11 in both prod and dev, and it works in build, but fails in dev, because of the websocket. Workarounds presented here haven't worked for me. I've been having to test changes by doing builds and static serving. |
None of the workarounds mentioned worked for me in development mode. Any updates about it? |
@RickeyWard Have you resolved this issue yet? I'm having the same problem. |
I finally have a workaround after looking at this for a couple of days I had to change the client for WebpackDevServer from react-dev-utils/webpackHotDevClient to the alternative of webpack/hot/dev-server You have to go to your webpack.config.js file and swap out this line:
with this one:
|
@a1g0rithm This worked for me, thank you very much. |
I downgrade CRA to 3.2.0 to make it work. |
Did you have to do anything else? Because while this works to load up the page in IE, hot reload no longer works. You have to refresh the page manually to see the changes. |
Unfortunately, hot reloading won't work. Not sure if downgrading like @Felix-Indoing suggests keeps it from breaking. |
Hey, I'm having the same issue with IE9.. anyone here found a solution that does NOT involve ejecting? .. using the polifills does not seems to do any magic. |
I have a fully functional application that runs in IE9. There were several fixes I had to make that are not mentioned in this thread. I ejected but if you provide your error I may be able to point you in the right direction. |
After reading this comment, I found the following solution works with hot reload. I'm on v3.4.1 of
import "react-app-polyfill/ie9"
import "react-app-polyfill/stable"
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
Se usa el soporte de create-react-app: https://create-react-app.dev/docs/supported-browsers-features/ y https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md#polyfilling-other-language-features. IE 11 está soportado en producción pero no en desarrollo (facebook/create-react-app#7316 y facebook/create-react-app#5336).
@vincent Uncaught SyntaxError: Use of const in strict mode /sattic/js/main.chunk.js 199:1 SyntaxError :Use of const in strict mode |
I created a create react app to run on Android 5.0. This problem does not appear in the higher version of Android. Some people say it is node_ modules/webpack-dev-server/client/ index.js There is no compilation here. I need to compile manually. I don't know how to configure it |
I created a create react app to run on Android 5.0. This problem does not appear in the higher version of Android. Some people say it is node_ modules/webpack-dev-server/client/ index.js There is no compilation here. I need to compile manually. I don't know how to configure it but!!! i use your method It didn't work |
After reading all the comments this what works for my app:
|
Can this issue be closed - it seems to be resolved? |
@raix the core of the issue was never about webpack but imported deps that break when developing in older browsers. I no longer need this so I will close it. If someone else reports an error they can open a new 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(R) Core(TM) 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:)
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.
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 onsetPrototypeOf
. Using the catch allrequire('core-js');
allows the app to work as expected.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.The text was updated successfully, but these errors were encountered: