To embed the contents of an SVG file into your site using NextJS with the new Rust-based compiler (Turbopack), perform the following steps:
- Install
@svg/webpack
:
$ npm install --save-dev @svgr/webpack
- Add to your webpack config in
next.config.js
with the following options. This will remove the width and height from the SVG but keep the viewBox for correct scaling.