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

fix(webpack): bring back previous SVG and SVGR behavior for React projects #22628

Merged
merged 1 commit into from Apr 3, 2024

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Apr 2, 2024

The removal of file-loader from React's webpack configuration caused a breaking change where importing default like so:

import svg from './example.svg';
export App() {
  return <img src={svg} alt="" />
}

Results in a React component via SVGR rather than a proper asset. There is no way to make asset modules from Webpack 5 work with the existing behavior, so we should introduce the new behavior later in Nx 20 as a breaking change + a migration.

Current Behavior

SVG default export is always a React component.

Expected Behavior

SVG assets should work for React projects.

Related Issue(s)

Fixes #21773

@jaysoo jaysoo requested a review from a team as a code owner April 2, 2024 18:28
@jaysoo jaysoo requested a review from ndcunningham April 2, 2024 18:28
Copy link

vercel bot commented Apr 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Apr 2, 2024 8:55pm

@jaysoo jaysoo force-pushed the issue_21773 branch 8 times, most recently from 4e45b19 to ded0403 Compare April 2, 2024 20:40
@jaysoo jaysoo merged commit 270788e into master Apr 3, 2024
6 checks passed
@jaysoo jaysoo deleted the issue_21773 branch April 3, 2024 00:46
FrozenPandaz pushed a commit that referenced this pull request Apr 5, 2024
Copy link

github-actions bot commented Apr 9, 2024

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SVG default import behaviour changed for webpack
2 participants