Skip to content

CRA 2 SVG import doesn't seem to work with Icon source #449

@mbriggs

Description

@mbriggs

Issue summary

The recommended way to use a custom icon is to do something like this

import icon from "./icon.svg";
import { Icon } from "@shopify/polaris";

<Icon source={icon} />

Create React App v2 uses SVGr to create react components out of svg imports.

I may just be being dumb, but I don't see any way to make the two libraries work with each other.

Expected behavior

It would be nice if <Icon source /> supported the react components generated by SVGr, but really any solution of getting custom icons into Polaris when using CRA2 would be great.

Actual behavior

You get no result from <Icon/>

Steps to reproduce the problem

  1. create a new CRA app
  2. attempt to use a custom SVG with Icon

Specifications

  • Are you using the React components? (Y/N): Y
  • Polaris version number: tried on both latest version of 2, and 3 beta
  • Browser: Chrome 69
  • Device: Macbook Pro
  • Operating System: OSX

⚓️ We’re not accepting pull requests at this time

🗒 We are accepting issue reports and feature requests

🌟 Feature requests that we can’t get to right away will be closed. However, we track all requests and will use it to set priorities. See the contribution guidelines for more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions