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

Using svgr webpack with Payload #7008

Closed
pcarillion opened this issue Jul 2, 2024 · 2 comments
Closed

Using svgr webpack with Payload #7008

pcarillion opened this issue Jul 2, 2024 · 2 comments
Labels

Comments

@pcarillion
Copy link

Link to reproduction

No response

Payload Version

[email protected]

Node Version

20

Next.js Version

15

Describe the Bug

Use SVGR with webpack as described here
https://blog.logrocket.com/import-svgs-next-js-apps/#import-svgs-next-js-using-svgr

Running dev or build fails

`./node_modules/.pnpm/@payloadcms[email protected][email protected]_next@15.0.0-rc.0_@babel[email protected]_react-d_6btuzme2v3pjqg2bytl3nrltfa/node_modules/@payloadcms/ui/dist/assets/payload-favicon.svg
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

| <style>
| path {

Import trace for requested module:
./node_modules/.pnpm/@payloadcms[email protected][email protected]_next@15.0.0-rc.0_@babel[email protected]_react-d_6btuzme2v3pjqg2bytl3nrltfa/node_modules/@payloadcms/ui/dist/assets/payload-favicon.svg`

Reproduction Steps

Adapters and Plugins

"@svgr/webpack": "^8.1.0"

@pcarillion pcarillion added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels Jul 2, 2024
@rilrom
Copy link

rilrom commented Jul 3, 2024

Add this whole thing to your next.config.js, this is what resolved it for me.

https://react-svgr.com/docs/next/#usage

@paulpopus
Copy link
Contributor

Hey @pcarillion can you confirm if the above fixes this issue for you please? I'll close the issue for now unless there's further problems confirmed

@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants