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

webpack-dev-server doesn't serve sprite with v4.0 and webpack 2 #133

Open
sergek opened this issue Mar 20, 2017 · 1 comment
Open

webpack-dev-server doesn't serve sprite with v4.0 and webpack 2 #133

sergek opened this issue Mar 20, 2017 · 1 comment

Comments

@sergek
Copy link

sergek commented Mar 20, 2017

Hi, I've tried v4.0 and webpack2 and I'm having an issue with webpack-dev-sever not serving svg sprite over ajax request (404).

This is string from my app
const svg = {
path: '/sprite/*.svg',
name: '/assets/[hash].sprite.svg'
};
require('webpack-svgstore-plugin/src/helpers/svgxhr')(svg);

This is the single string about the sprite file in webpack-dev-server output
/assets/1490001270004.sprite.svg 12.4 kB [emitted]

console.log(svg.filename) in runtime returns
//assets/1490001270004.sprite.svg

but the actual ajax request for the file always return 404
Cannot GET /assets/1490001270004.sprite.svg

If I run webpack build, then webpack does generate and save sprite to fs no problems, so the problem I have only related to webpack-dev-server and serving the svg from memory.

Any thoughts on how to debug such a behavior?
Thanks!

@kulaeff
Copy link

kulaeff commented Apr 20, 2017

Try to use let instead of const.

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

No branches or pull requests

2 participants