-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-remark-autolink-headers): remove hardcoded "let" keyword #21083
fix(gatsby-remark-autolink-headers): remove hardcoded "let" keyword #21083
Conversation
This resolves #21058 In `gatsby-remark-autolink-headers`, this code snippet https://github.com/gatsbyjs/gatsby/blob/5e7ccd13f79e54036869a72e423bf7cf4ab486af/packages/gatsby-remark-autolink-headers/src/gatsby-ssr.js#L51-L67 contains 2 instances of hardcoded "let" keyword, which is being rendered into the HTML without transpilation. This makes the script crash in old browsers, such as IE (all versions). This commit replaces "let" to "var". Care should be taken because this is an unsafe transformation, due to var scope hoisting. My initial tests show that everything is good. I initially encountered this error while porting https://nextstrain.org to IE: nextstrain/nextstrain.org#113 This fix should help scientists researching 2019-nCoV outbreak (some of them still use Internet Explorer)
Ok, this makes sense - can we add comment above
part to mention that using |
@pieh Hi Michal, thanks for the quick response! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks @ivan-aksamentov!
Yup, we already used |
Holy buckets, @ivan-aksamentov — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
Description
In
gatsby-remark-autolink-headers
, this code snippetgatsby/packages/gatsby-remark-autolink-headers/src/gatsby-ssr.js
Lines 51 to 67 in 5e7ccd1
contains 2 instances of hardcoded "let" keyword, which is being rendered into the HTML without transpilation. This makes the script crash in old browsers, such as IE (all versions).
This commit replaces "let" to "var". Care should be taken because this is an unsafe transformation, due to var scope hoisting. My initial tests show that everything is good.
I initially encountered this error while porting https://nextstrain.org to IE: nextstrain/nextstrain.org#113
This fix should help scientists researching 2019-nCoV outbreak (some of them still use Internet Explorer)
Documentation
N/A
Related Issues
Fixes #21058