Skip to content

Commit 68672d1

Browse files
authored
fix: check if html file exists before reading it (#331)
1 parent 43fa399 commit 68672d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/plugins/pluginAddEntry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const addEntry = ({
119119
emitFileOptions.fileName = fileName;
120120
}
121121
emitFileId = this.emitFile(emitFileOptions);
122-
if (htmlFilePath) {
122+
if (htmlFilePath && fs.existsSync(htmlFilePath)) {
123123
const htmlContent = fs.readFileSync(htmlFilePath, 'utf-8');
124124
const scriptRegex = /<script\s+[^>]*src=["']([^"']+)["'][^>]*>/gi;
125125
let match: RegExpExecArray | null;

0 commit comments

Comments
 (0)