SVG Sprite not working in CSS - [object Object]
See original GitHub issueDo you want to request a feature, report a bug or ask a question? Report a bug
What is the current behavior?
SCSS input:
background: url('../../static/images/svg-sprites/caret-down.svg') no-repeat;
CSS output:
background: url(http://localhost:3000/[object Object]) no-repeat;
What is the expected behavior?
SCSS input:
background: url('../../static/images/svg-sprites/caret-down.svg') no-repeat;
CSS output:
background: url(http://localhost:3000/images/sprites.svg#caret-down) no-repeat;
If the current behavior is a bug, please provide the steps to reproduce, at least part of webpack config with loader configuration and piece of your code. Webpack config for SVG is simple:
{
test: /static\/images\/svg-sprites\/.*\.svg$/,
use: [
{
loader: 'svg-sprite-loader',
options: {
spriteFilename: 'images/sprites.svg'
}
},
{
loader: 'svgo-loader'
}
]
}
Importing SVG files in JS are working.
The best way is to create repo with minimal setup to demonstrate a problem (package.json, webpack config and your code). It you don’t want to create a repository - create a gist with multiple files https://gist.github.com/GrzegorzZajac000/86618bf29024a7b82e9fb7c0863b7c30 - base webpack config https://gist.github.com/GrzegorzZajac000/adb2a4888d1e64756a68e690460111b2 - dev webpack config
If this is a feature request, what is motivation or use case for changing the behavior?
Please tell us about your environment:
- Node.js version: v8.6.0
- webpack version: 3.5.5
- svg-sprite-loader version: 3.5.1
- OS type & version: MacOS High Sierra 10.13
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (7 by maintainers)
Top GitHub Comments
@vitortalaia in your case it can be fixed by setting
esModule: false
in loader config:Is there a resolution for background: url(…/…/C:/myApp/src/img/icn/arrw.svg);
issue ?