Create-react-app: svg import as React Component is not working in Internet Explorer

Created on 14 May 2020  路  1Comment  路  Source: facebook/create-react-app

Describe the bug

Importing svg as React component is not working in Internet Explorer (IE 11)

Environment


every environment for IE 11 is not working with [email protected]

Steps to reproduce

  1. npx create-react-app example & cd example
  2. Import any svg as react component.
    import { ReactComponent as ExampleIcon} from './assets/example-icon.svg' and render
    <ExampleIcon />

Expected behavior


should render svg

Working in chrome
chrome

Actual behavior


not rendering in IE 11 (throws error )
IE11

Reproducible demo

Edit react-ts

app-link: application link

bug report needs triage

Most helpful comment

This is not a CRA bug.

You can try copying the contents of browserslist.production to browserslist.development. This is in package.json.

reac

By default, the supported browsers in development mode are last 1 chrome version, last 1 firefox version and last 1 safari version.

You may have to delete node_modules/.cache to have the targets refresh.

>All comments

This is not a CRA bug.

You can try copying the contents of browserslist.production to browserslist.development. This is in package.json.

reac

By default, the supported browsers in development mode are last 1 chrome version, last 1 firefox version and last 1 safari version.

You may have to delete node_modules/.cache to have the targets refresh.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aranir picture Aranir  路  3Comments

DaveLindberg picture DaveLindberg  路  3Comments

stopachka picture stopachka  路  3Comments

fson picture fson  路  3Comments

Evan-GK picture Evan-GK  路  3Comments