-
Notifications
You must be signed in to change notification settings - Fork 194
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
const
injected in runtime code
#297
Comments
Hi, that is actually done deliberately on purpose. All modern browser since 2016 have working implementations of |
We are trying to replace RHL with react-refresh but we need to support old browsers (like Chrome 30-40 f.e) but these It seems sad to me to not support all the projects that need to take into account old browsers (not only IE) just because of these few line 😞 but if it's done deliberately, maybe this should be explicitly said in the README / FAQ (?). |
I understand the frustration - I'll look into it, in particular I don't think we rely on any scoping behaviours from |
Just wondering why do you support chrome 30-40? They did not get security updates for 5 or more years already. |
This bug can be seen in all browsers versions that don’t support const / let in strict mode, not only Chrome 30-40. For our case, we support Chrome since v30 because the platforms (old tv) where our project is run can’t update to newer version of chrome. |
To be honest, the pragmatist in me definitely does not want to support these browsers, but given React supports browsers down to IE9 I'm not sure about how compelling our argument on this case would be. However, given that Webpack 5 now does have APIs to selectively target specific environments and we already lean on it with the crucial runtime init code, maybe it makes sense to actually use that more to ensure not only compat with older browsers but also pure ESM environments (#294). It does make the template code more difficult to maintain and lint because now it is not really pure JavaScript. |
Like said, it’s not only for Chrome 30-40, this bug is viewable on iOS 9, which imply supporting (or not) iPad 2, iPhone 4S ... +1 for the fact that React itself supports IE >= 9. |
Thanks for this super cool project!
In
RefreshModule.runtime.js
,const
are injected in runtime code and will not be transpiled (since it's a loader injected code).This is critical in old browser that do not support
const
in strict mode for example.Elsewhere in the codebase i've seen a
supportsConst
method that seems to handle this specific case, maybe the code injected byRefreshModule.runtime.js
should do the same.The text was updated successfully, but these errors were encountered: