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 using SVG as ReactComponent #22582

Closed
1 of 4 tasks
karolis-96 opened this issue Mar 29, 2024 · 3 comments
Closed
1 of 4 tasks

Error using SVG as ReactComponent #22582

karolis-96 opened this issue Mar 29, 2024 · 3 comments
Assignees
Labels
outdated scope: react Issues related to React support for Nx type: bug

Comments

@karolis-96
Copy link

Current Behavior

import { FC } from 'react';

import { ReactComponent as Test } from './utils/bye.svg';

const App: FC = () => (
  <div>
    <Test />
  </div>
);

export default App;

using like this throws error

Expected Behavior

No error and svg icon visible as component in dom

GitHub Repo

No response

Steps to Reproduce

Nx Report

Node   : 21.2.0
OS     : win32-x64
yarn   : 1.22.19

nx (global)        : 18.1.3
nx                 : 18.2.1
@nx/js             : 18.2.1
@nx/jest           : 18.2.1
@nx/linter         : 18.2.1
@nx/eslint         : 18.2.1
@nx/workspace      : 18.2.1
@nx/devkit         : 18.2.1
@nx/eslint-plugin  : 18.2.1
@nx/react          : 18.2.1
@nrwl/tao          : 18.2.1
@nx/web            : 18.2.1
typescript         : 5.4.3
---------------------------------------
Community plugins:
@nx/rspack : 18.0.6

Failure Logs

ERROR in ./apps/insight/src/utils/bye.svg
  × Module parse failed:
  ╰─▶   × JavaScript parsing error: Expected ';', '}' or <eof>
         ╭─[1:1]
       1 │ <svg width="14" height="16" viewBox="0 0 14 16" fill="none" xmlns="http://www.w3.org/2000/svg">
         ·      ─────
       2 │ <path d="M14 9.00067H10.0004V1.08016e-05H4.00096V9.00067H0.00134277L7.00067 16L14 9.00067Z" fill="currentColor"/>
       3 │ </svg>
         ╰────

  help:
        You may need an appropriate loader to handle this file type.


ERROR in ./apps/insight/src/utils/bye.svg
  × Module parse failed:
  ╰─▶   × JavaScript parsing error: Expression expected
         ╭─[1:1]
       1 │ <svg width="14" height="16" viewBox="0 0 14 16" fill="none" xmlns="http://www.w3.org/2000/svg">
         · ─
       2 │ <path d="M14 9.00067H10.0004V1.08016e-05H4.00096V9.00067H0.00134277L7.00067 16L14 9.00067Z" fill="currentColor"/>
       3 │ </svg>
         ╰────

  help:
        You may need an appropriate loader to handle this file type.


Rspack 0.5.9 compiled with 2 errors in 2.42 s

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@BogdanMihalca
Copy link

might be related (same) to this one: #22362

@FrozenPandaz FrozenPandaz added the scope: react Issues related to React support for Nx label Apr 2, 2024
@ndcunningham
Copy link
Contributor

Should be addressed with: #22628

Check out the latest canary until a new version has been released!

Copy link

github-actions bot commented May 9, 2024

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react Issues related to React support for Nx type: bug
Projects
None yet
Development

No branches or pull requests

4 participants