Skip to content
This repository was archived by the owner on Mar 18, 2023. It is now read-only.

In Webpack-dev-server not work added svg-sprite #152

Open
leonidkuznetsov18 opened this issue Aug 23, 2017 · 3 comments
Open

In Webpack-dev-server not work added svg-sprite #152

leonidkuznetsov18 opened this issue Aug 23, 2017 · 3 comments
Labels

Comments

@leonidkuznetsov18
Copy link

leonidkuznetsov18 commented Aug 23, 2017

"webpack": "^2.6.0",
"webpack-svgstore-plugin": "^4.0.1"

// in component/Icon.js
import svgxhr from 'webpack-svgstore-plugin/src/helpers/svgxhr';

const __svg__ = {
  path: '../../assets/icons/*.svg',
  name: 'sprite.svg',
};
svgxhr(__svg__);```

// webpack.config.js
const SvgStore = require('webpack-svgstore-plugin');
 new SvgStore(),
`devServer: {
      contentBase: './app',
      publicPath: '/',
      historyApiFallback: true,
      port,
      host,
      hot: !isProd,
      compress: isProd,
      stats,
      proxy: useProxy ? proxy : {},
    },

Not added if i use dev server.
But if i use build ш рфму sprite.svg.
Please help for this issue

@rewop
Copy link

rewop commented Aug 23, 2017

I think I have the same issue. My svgs are not loaded when I use react storybook. And react storybook uses webpack-dev-server.

As far as I see, in the generated bundle the variable __svg__ is not overwritten, and the filenameproperty is not added to the options.

This means that the variable url in svgxhr.js file is false.

For some reasons the parser function is never invoked.

@collimik
Copy link

collimik commented Oct 13, 2017

I've the same issue and have arrived at the same conclusions as @rewop. I'm running an ejected Create React App.

@nelsieborja
Copy link

Came across same issue but managed to get it work by following the suggestion from here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants