Is it possible to entirely disable a node library from loading in IE?
I'm using React.js and a library called Nivo ("@nivo/line": "^0.61.1") to draw a graph. Nivo uses d3 to draw its graphs, and d3 doesn't load correctly when using IE11. An error prints in the console "const must be initialized", which is caused by d3-scale not being in ES5. We're using babel polyfill ("@babel/polyfill": "^7.8.3") to transpile our source code into ES5 which is working fine, but the node_modules aren't being transpiled. I've tried modifying the webpack build module to include the d3-scale library in the transpiling using different variations of the following, but so far this has not been successful:
exclude: [
/node_modules\/(?!d3-scale)/,
/\.stories\.js$/,
/\.test\.js$/,
],
A possible workaround is to disable the graph for IE entirely so that the Nivo library isn't loaded at all, but continues to work for other browsers. Is this possible?
If anyone has any other suggestion for how to solve this please let me know.
Here's a snippet of our graph code:
import React, {Component} from 'react';
import {ResponsiveLine} from '@nivo/line';
import {formatNumbers} from 'Utils/formatNumbers';
...
render() {
return (
<>
{ this.props.data.length > 0 ? (
<ResponsiveLine
...
/>
...
This component is then used by another component.