Added a webpack clean plugin to the demo and emiting assets via build info
parent
c3b1a70f56
commit
9e41c79f55
|
@ -1,5 +1,6 @@
|
|||
import * as path from "path";
|
||||
import {Configuration} from "webpack";
|
||||
import {CleanWebpackPlugin} from "clean-webpack-plugin";
|
||||
import * as SpriteGenerator from "../plugin";
|
||||
import * as HtmlWebpackPlugin from "html-webpack-plugin";
|
||||
|
||||
|
@ -8,6 +9,7 @@ export = {
|
|||
target: "web",
|
||||
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(),
|
||||
new SpriteGenerator.Plugin({
|
||||
dtsOutputFolder: path.join(__dirname, "app"),
|
||||
configurations: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "webpack-svg-sprite-generator",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.13",
|
||||
"description": "",
|
||||
"main": "plugin.js",
|
||||
"types": "ts/index.d.ts",
|
||||
|
|
|
@ -69,7 +69,10 @@ class SvgSpriteModule extends Module {
|
|||
async: false,
|
||||
exportsType: undefined
|
||||
};
|
||||
this.buildInfo = {};
|
||||
this.buildInfo = {
|
||||
cacheable: true,
|
||||
assets: {}
|
||||
};
|
||||
|
||||
if(this.spriteAssetName) {
|
||||
delete compilation.assets[this.spriteAssetName];
|
||||
|
@ -83,7 +86,7 @@ class SvgSpriteModule extends Module {
|
|||
this.spriteAssetName = "sprite-" + sha1(this.spriteSvg).substr(-20) + ".svg";
|
||||
this.spriteAssetUrl = (compilation.options.output.publicPath || "") + this.spriteAssetName;
|
||||
|
||||
compilation.assets[this.spriteAssetName] = new RawSource(this.spriteSvg);
|
||||
this.buildInfo.assets[this.spriteAssetName] = new RawSource(this.spriteSvg);
|
||||
|
||||
this.spriteCss = "";
|
||||
for(const cssOption of this.config.cssOptions) {
|
||||
|
|
Loading…
Reference in New Issue