Search code examples
javascriptreactjsmaterial-uibabeljscore-js

Commenting useState prevents crash on IE11


I uploaded a repository.

dist/index.htm cause a crash on IE11 like the following.

unable to get property 'root' of undefined or null reference

// inner.jsx
import { Grid } from '@material-ui/core';
import React, { useState } from 'react';

export function Inner() {
  var [path] = useState(''); // <- why commenting this prevents crash?
  return <Grid container></Grid>;
}

But with commenting var [path] = useState('') in src/inner.jsx and run npm run publish, that crash doesn't occur. I can't understand the result.

Is it bug? if then, where should I file an issue?


Solution

  • Changing useBuiltIns: 'usage' to useBuiltIns: 'entry' resolves the issue with IE11.