Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing SVG with @wordpress/scripts #20088

Closed
grappler opened this issue Feb 7, 2020 · 1 comment · Fixed by #20916
Closed

Error parsing SVG with @wordpress/scripts #20088

grappler opened this issue Feb 7, 2020 · 1 comment · Fixed by #20916
Assignees
Labels
Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress [Tool] WP Scripts /packages/scripts

Comments

@grappler
Copy link
Member

grappler commented Feb 7, 2020

Describe the bug
When running wp-scripts build with the following code gives an error.

NonErrorEmittedError: (Emitted value instead of an instance of Error) Error in parsing SVG: Non-whitespace before first tag.

import starUrl, { ReactComponent as Star } from './star.svg'
const App = () => (
  <div>
    <img src={starUrl} alt="star" />
    <Star />
  </div>
)

To reproduce
Steps to reproduce the behavior:

  1. import a SVG file using the above example as a template
  2. run the build task from wp-scripts
  3. See error

Expected behavior
The build process to complete successfully

Versions

  • Using @wordpress/scripts version 7.0.1

Related Gutenberg issue: #14628
Introduced in: #18243

Related slack discussion: https://wordpress.slack.com/archives/C5UNMSU4R/p1580939781306900

Reason for bug: Incompatibility between @svgr/webpack:4.3.3 and url-loader:3.0.0 which was fixed in @svgr/webpack:5.0.0 as documented in gregberge/svgr#367.

The proposed solution is to update @svgr/webpack to version 5.0 or greater.

@swissspidy swissspidy added the [Tool] WP Scripts /packages/scripts label Feb 7, 2020
@gziolo gziolo added the Needs Dev Ready for, and needs developer efforts label Mar 8, 2020
@gziolo gziolo self-assigned this Mar 16, 2020
@gziolo gziolo added the [Status] In Progress Tracking issues with work in progress label Mar 16, 2020
@gziolo
Copy link
Member

gziolo commented Mar 16, 2020

The patch is ready #20916.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress [Tool] WP Scripts /packages/scripts
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants