webpack-svgstore-plugin icon indicating copy to clipboard operation
webpack-svgstore-plugin copied to clipboard

Calling wrong url to the svg file on production

Open iamrane opened this issue 8 years ago • 3 comments

When i try it on dev it works perfect, when Im trying this on production its calling with a weird url. https://www.mydomaincom/https://www.mydomaincom/static/1487869309421.icons.svg

webpack.base.js

var SvgStore = require('webpack-svgstore-plugin');
var plugins = [
new SvgStore.Options({
  svgoOptions: {
    plugins: [
      { removeDesc: true },
      { removeAttrs: { attrs: 'fill|class|style' } },
      { removeStyleElement: true },
      { removeRasterImages: true },
     { sortAttr: true }
  ]
}})

in my js

var __svg__ = {path: '../../../styles/images/svg-icons/**/*.svg', name: '[hash].icons.svg'};
require('webpack-svgstore-plugin/src/helpers/svgxhr')(__svg__);

iamrane avatar Feb 24 '17 08:02 iamrane

you need to set a base url tag in your html

nadavsinai avatar Mar 12 '17 10:03 nadavsinai

my mistake, looking at the code it seems that the public url by webpack config is what's used here, so set that accordingly see https://github.com/mrsum/webpack-svgstore-plugin/pull/110/commits/37880b357bddead285a046e8abbaef1f318c93dd

nadavsinai avatar Mar 12 '17 10:03 nadavsinai

I'm having this same issue and @nadavsinai I'm not quite sure I understand what your solution is/was.

jarodtaylor avatar May 12 '17 03:05 jarodtaylor