html-inline-webpack-plugin
Advanced tools
Comparing version
@@ -43,9 +43,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
} | ||
performAsset(compilation) { | ||
fs_1.default.readFile(this.path, (err, data) => { | ||
if (err) { | ||
throw new Error(`Exception while reading the file of a given favicon path: ${err.message}`); | ||
} | ||
compilation.emitAsset(this.assetName, new webpack_1.sources.RawSource(data)); | ||
}); | ||
async performAsset(compilation) { | ||
try { | ||
const buffer = fs_1.default.readFileSync(this.path); | ||
const source = buffer.toString(); | ||
compilation.emitAsset(this.assetName, new webpack_1.sources.RawSource(source)); | ||
} | ||
catch (err) { | ||
throw new Error(`Exception while reading the file of a given favicon path: ${err.message}`); | ||
} | ||
} | ||
@@ -52,0 +54,0 @@ } |
@@ -17,3 +17,3 @@ import { HTMLElement } from "node-html-parser"; | ||
perform(compilation: Compilation, parent: HTMLElement): void; | ||
performAsset(compilation: Compilation): void; | ||
performAsset(compilation: Compilation): Promise<void>; | ||
} |
{ | ||
"name": "html-inline-webpack-plugin", | ||
"description": "This webpack plugin package is bundling related HTML files by injecting inline tags.", | ||
"version": "1.0.0-beta4", | ||
"version": "1.0.0-beta5", | ||
"main": "./dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "./dist/types/index.d.ts", |
@@ -8,3 +8,3 @@ <div align="center"> | ||
<th>Version</th> | ||
<th>v1.0.0-beta4</th> | ||
<th>v1.0.0-beta5</th> | ||
</tr> | ||
@@ -11,0 +11,0 @@ </tbody> |
@@ -32,11 +32,11 @@ import { HTMLElement } from "node-html-parser"; | ||
performAsset(compilation: Compilation) { | ||
fs.readFile(this.path, (err, data) => { | ||
if (err) { | ||
throw new Error(`Exception while reading the file of a given favicon path: ${err.message}`); | ||
} | ||
compilation.emitAsset(this.assetName, new sources.RawSource(data)); | ||
}); | ||
async performAsset(compilation: Compilation) { | ||
try { | ||
const buffer = fs.readFileSync(this.path); | ||
const source = buffer.toString(); | ||
compilation.emitAsset(this.assetName, new sources.RawSource(source)); | ||
} catch (err) { | ||
throw new Error(`Exception while reading the file of a given favicon path: ${(err as Error).message}`); | ||
} | ||
} | ||
} |
43767
0.34%826
0.36%