Open jarodtaylor opened 7 years ago
I am experiencing an issue similar to this.
I am using browserSync with webpackDevMiddleware and a proxy.
My first thought was that maybe this is related to publicPath
, but I haven't yet had a chance to debug fully.
I fixed my issue by altering publicPath.
@designspin Can u tell me how did you fix this?I am also facing this issue
Well, there is a workaround: you can write own loading function.
Just look at ./node_modules/webpack-svgstore-plugin/src/helpers/svgxhr.js
, there is a code responsible for composing final URL:
if (typeof baseUrl === 'undefined') {
if (typeof window.baseUrl !== 'undefined') {
baseUrl = window.baseUrl;
} else {
baseUrl = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
}
}
You can copy entire function, modify it and use instead of standard loader.
In my case, because of let replacement = expr.id.name + ' = { filename: ' + "__webpack_require__.p +" + '"' + data.fileName + '" }';
in svgstore.js webpack created filename with some addition (publicPath). But I use proxy (browsersync and http-proxy-middleware), so site is exposed on different url than publicPath (publicPath is absolute in my webpack config). Now while requesting sprite, loader try to compose final url from window.location parts and filename, which contains full path already.... So I created own loader. Now works fine, because I don't care about window.location.
I did a simpler workaround: https://github.com/mrsum/webpack-svgstore-plugin/issues/156. Hope it helps
can confirm that this is an issue when using html-webpack-plugin with publicPath set. I'll see if I can put together a PR to fix
hi, Just FYI, i've done this work and you can use my fork. npm i @algotec/webpack-svgstore-plugin#v5.1.2
I'm trying to get the owners to merge this for a while now...
I get this in my Chrome console:
VM21594:1 GET http://localhost:3000/http://localhost:3000/assets/svg/1494566510680.logos.svg 404 (Not Found)
If I console log svg I can see the filename: http://localhost:3000/assets/svg/1494566510680.logos.svg
and this filename works because when I view source I see the
What am I doing incorrectly?