🚀 next-svgr
Plugin for Next to automatically be able to transform svg
files into components using the excellent svgr
library.
Table of contents
Installation
npm install --save next-svgr
Or using yarn:
yarn add next-svgr
Then, import the library in your next.config.js
file.
// next.config.jsconst withSvgr = ; moduleexports = ;
Or you can use it with next-compose-plugins
for a cleaner configuration.
// next.config.jsconst withPlugins = ;const withSvgr = ; moduleexports = ;
Usage
You can now start importing your SVG files as if they were components:
; <div> <MyIcon /> </div>;
Please check the documentation of svgr for more examples.