diff --git a/package.json b/package.json index b0d6028..70724bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack-svg-sprite-generator", - "version": "5.0.1", + "version": "5.0.2", "description": "", "main": "plugin.js", "types": "ts/index.d.ts", diff --git a/plugin/plugin.ts b/plugin/plugin.ts index 7e84001..5ba5d2f 100644 --- a/plugin/plugin.ts +++ b/plugin/plugin.ts @@ -20,7 +20,8 @@ export interface Options { dtsOutputFolder: string, configurations: { [key: string] : SvgSpriteConfiguration - } + }, + publicPath?: string, } @@ -122,7 +123,7 @@ class SvgSpriteModule extends Module { this.spriteSvg = await generateSpriteSvg(this.sprite); this.spriteAssetName = "sprite-" + sha1(this.spriteSvg).substr(-20) + ".svg"; - this.spriteAssetUrl = this.spriteAssetName; + this.spriteAssetUrl = (this.pluginConfig.publicPath || "") + this.spriteAssetName; this.buildInfo.assets[this.spriteAssetName] = new RawSource(this.spriteSvg);