DEV Community

nitaking
nitaking

Posted on

2

How to work with inline SVG in Blitz.js(Next.js)

hero

In Blitz.js, it was taken up by issue that the inline SVG does not work when set up as documented in Blitz.js.

This is an issue with Next.js and is covered in issue here.
Blitz.js is built on top of Next.js and the front end is equivalent to Next.js.
It can be solved with the same response as Next.js

First - Install packages

$ yarn add babel-plugin-inline-react-svg
$ yarn add babel-plugin-module-resolver
Enter fullscreen mode Exit fullscreen mode

Second - Edit babel.config.js

module.exports = {
  presets: ["next/babel"],
  plugins: [
    ["module-resolver", { "root": ["."] }],
    "inline-react-svg",
  ],
}
Enter fullscreen mode Exit fullscreen mode

Now you should be able to view your SVGs!

If you don't know how to do it, I've uploaded the source to Github and you can take a look at it.

https://github.com/nitaking/sample-blitz-svg-setting

Click here for specific commitments.

It shows up like this 🙌

result

Have a good Blitz.js life!

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more