diff --git a/lib/plugin.js b/lib/plugin.js
index <HASH>..<HASH> 100644
--- a/lib/plugin.js
+++ b/lib/plugin.js
@@ -216,8 +216,11 @@ class SVGSpritePlugin {
 
   beforeHtmlGeneration(compilation) {
     const itemsBySprite = this.map.groupItemsBySpriteFilename();
+    const filenamePrefix = this.rules.publicPath
+            ? this.rules.publicPath.replace(/^\//, '')
+            : '';
     const sprites = Object.keys(itemsBySprite).reduce((acc, filename) => {
-      acc[filename] = compilation.assets[filename].source();
+      acc[filenamePrefix + filename] = compilation.assets[filenamePrefix + filename].source();
       return acc;
     }, {});
Fix the  bug of publicPath

Once  the publicPath is set and is not equal to / , an error will be report with "TypeError: Cannot read property 'source' of undefined", Because the  assets map have not contain the value of publicPath.