Skip to main content

All Questions

Tagged with
0 votes
0 answers
30 views

Can't import svg as React component in Webpack 5 with Single SPA

I have an Single SPA app based on React with Webpack 5. Importing it in my component: import SVG from '../assets/some.svg; <div> <SVG/> </div> My webpack settings look like this:...
Foxyfox's user avatar
0 votes
0 answers
20 views

In webpack, how can me make sure that the inline styles of svg files are overridden by the css styles

I am using webpack for bundling and running my typescript react and I am facing an issue where svg file's inline style is not being overridden by the css styles. This was working as intented when I ...
Hari Vamshi's user avatar
0 votes
0 answers
26 views

Webpack loader required for react component in node_module but not if it is local

I am using NextJS and recently installed a package called react-pay-icons (library that exports a bunch of SVG's). When importing one of the components, I get a build error: You may need an ...
mfergusson's user avatar
0 votes
0 answers
17 views

svg-sprite-loader how to use https:// svg link data source? [duplicate]

Use case: I am building out a site where the client wants to be able to select and upload their own svg icon for their site. I have decided to use svg-sprite-loader as a method to reduce overhead on ...
snmln's user avatar
  • 21
0 votes
0 answers
28 views

The typing of declare module does not work when trying to install .svg

Installed @svgr/webpack connected it configured Used this guide: Using svgr with webpack and TypeScript But even he didn't help solve the problem global.d.ts declare module "*.svg" { ...
Евгений Устюжанин's user avatar
0 votes
0 answers
15 views

SVG don't add to webpack project on React

I have a problem with uploading SVG icons in React. Only .png files upload correctly. When I run npm run dev, I get an error in console: GET http://localhost:8080/[object%20Module] net::ERR_ABORTED ...
Mary Kalugina's user avatar
1 vote
0 answers
427 views

How to import .svg images with SVGR in Storybook?

I have been trying to begin to use SVG imports in my Storybook stories, but any time I get an error. .storybook/main.ts import type { StorybookConfig } from '@storybook/nextjs'; const config: ...
Viktor's user avatar
  • 33
0 votes
1 answer
335 views

@svgr/webpack not working with css background image on webpack

I am trying to import an SVG using @svgr/webpack and css background property but it just removes the background property all together. I have this on webpack: import { babelLoader } from './loaders' ...
Álvaro's user avatar
  • 2,502
0 votes
1 answer
581 views

React: Styling SVG images as React components in TypeScript using SCSS

I'm using Webpack to allow importing SVG files as components in React Typescript. I'm having issues styling the SVGs using SCSS. I'm using a made-up attribute as a target for the css selector, but no ...
Matt Young's user avatar
1 vote
0 answers
391 views

How to use SVGR in reactjs and webpack with svg font?

I try to use SVGR to load SVG in my project with reactjs and webpack but I got an unexpected error like this: ERROR in ./node_modules/@fortawesome/fontawesome-free/webfonts/fa-regular-400.svg 1:0 ...
Rahele Nazari's user avatar
10 votes
1 answer
5k views

'Error: Plugin name should be specified' @svgr/webpack svgoConfig

I have @svgr/[email protected] installed and webpack config as below use: [ { loader: '@svgr/webpack', options: { svgoConfig: { plugins: [ ...
Deepak Negi's user avatar
1 vote
1 answer
2k views

Storybook loads .svg with file-loader instead to load it as React component

So what I am trying to have, is to import any .svg file as React component to be used as <SomeIcon /> instead of this I always get path to the file to be used like <img src={pathToIcon} /> ...
Michał Wojas's user avatar
0 votes
0 answers
1k views

issue with using svgr/webpack in next.js app

Trying to add SVGR into the next.js project. The issue with a building project, getting error: Module not found: Can't resolve '@svgr/webpack' Setps: Installed svgr as devDependecies Add svgr into ...
Mark James's user avatar
3 votes
1 answer
4k views

How to render SVGs coming from api response using next/image or <img> in Next.js?

I've got a bunch of svgs coming from an api response, which I get inside useEffect. Response looks like this {svg1: 'https://remoteserver.com/assests/svg1.svg', ...and so on} ( These svgs aren't ...
Sanjay's user avatar
  • 731
0 votes
1 answer
2k views

How to import SVG in ReactJS with craco?

I'm struggling to import SVG's when I'm using craco in my react app. It's suggested to use @svgr/webpack but I'm not sure how to put it into my craco.config.js My current setup as per this (I prob ...
wongx's user avatar
  • 8,493

15 30 50 per page
1
2 3 4 5
7