Skip to content

"SVG as a component" doesn't quite work in 2.x #3856

Closed
@gaearon

Description

@gaearon

We merged #3718 and released the first 2.x alpha, but quickly discovered a few issues:

  • Importing SVG from CSS is now broken, you get [Object object] in URLs.
  • While that can be fixed by adding a named export called toString() here (which would just return the URL), it looks like the resulting JS bundle contains the React component as soon as CSS imports it. It's my impression that webpack CSS pipeline still relies on CommonJS and therefore can't tree shake the component.

I'm not sure if there's any solution even possible here 😢 We probably need to revert the feature.

Just in case, pinging @neoziro @iansu for more ideas.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions