SyntaxError in Internet Explorer 11
See original GitHub issue🐛 Bug Report
Using @visx/scale
in Internet Explorer throws a SyntaxError due to the use of non-transpiled ES6 syntax in the some of its D3 dependencies (i.e. d3-scale
and d3-array
). It is possible that this affects other packages in the @visx
monorepo.
EDIT: Please note this was not a problem with the old @vx/scale
.
To Reproduce
Use the package in a IE11 context.
Expected behavior
I know there is debate on whether dependencies should be shipped already transpiled or not, but in general package maintainers ship different versions to accommodate different build targets.
Temporary solution
For those facing the same issue, I modified my Webpack config and made babel-loader
“un-ignore” the affected code like this. Although not ideal, it does the trick:
{
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules\/(?!d3-)/
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Javascript Syntax error in IE explorer 11, but ok in Chrome
I have a small bit of code that works fine in chrome with no errors. When run in Internet explorer I get a...
Read more >Internet Explorer Script Error. Error: Syntax error
Answer: · In Internet explorer go to Tools > Internet Options. · Click the Advanced Tab and the Reset... button. · Confirm you...
Read more >Syntax error 'SCRIPT1002' using internet explorer 11
I am facing an issue with the browser support in IE 11 of my reactjs project. Here is my code sample. package.json. JavaScript....
Read more >Internet Explorer 11: Bing Maps Website not loaded properly ...
The reason for this seems to be a syntax error caused by a JavaScript statement which is not supported by IE11. Image. The...
Read more >Syntax error in attributes.js for Internet Explorer 11 - Drupal
Syntax error in attributes.js for Internet Explorer 11 ... After updating the attributes.js changes from issue https://www.drupal.org/project/ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The solution @jbanulso suggested worked for me. And in the above case regarding
react-use-measure
I usedTooltipWithBounds
component instead ofTooltipInPortal
. It worked in ie11 without any issuesHi @jbanulso, thanks for opening this issue.
Yes, that seems right.
@visx/scale
bumped d3-scale dep to 3 here: https://github.com/airbnb/visx/commit/047140d2513975402df8dc046bb7b2a07d4904af#diff-217f22c28a2d867f392b420b3761151251a20535698ae9f218b844bb332e0e29R33 and d3-scale dropped IE11 support here: https://github.com/d3/d3-scale/releases/tag/v3.0.0One idea would be to move d3-scale and @types/d3-scale to be
peerDeps
and then folks could choose to use d3-scale@2 or d3-scale@3. But not sure how or if that would work with the current visx/scale implementation. We might be tied to v3.Visx will not be shipping with transpiled node_modules. This is something folks can opt into as seen in the temp solution. We should add a note to docs/readme for visx/scale including the workaround for IE11 support. Happy to review a PR that includes this.
cc @kristw and @williaster for additional thoughts and insights.