TypeError: Cannot read property '1' of undefined
- Dominant language
- JavaScript
- Stars
- 5k
- Forks
- 577
- PR merge metrics
- No merged PRs in 30d
Description
Hello, I just installed the latest version of `html-minifier`.
I added the following code to my angular ssr server side:
```
html = minify(html, {
caseSensitive: true,
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: true,
collapseWhitespace: true,
conservativeCollapse: true,
decodeEntities: false,
html5: true,
includeAutoGeneratedTags: false,
keepClosingSlash: false,
minifyCSS: true,
minifyJS: true,
preserveLineBreaks: false,
preventAttributesEscaping: false,
processConditionalComments: true,
// processScripts: ['text/html'],
removeAttributeQuotes: true,
removeComments: true,
removeEmptyAttributes: true,
removeEmptyElements: false,
removeOptionalTags: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
removeTagWhitespace: true,
sortAttributes: true,
sortClassName: true,
trimCustomFragments: true,
useShortDoctype: true,
});
```
And I get the following error:
```
let mode = stats[1];
^
TypeError: Cannot read property '1' of undefined
at isFileType (fs.js:193:19)
at Object.readFileSync (fs.js:380:16)
```
I am trying to parse angular-12 html page. If I remove it, the build will be successful.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the supplied Angular SSR call with the listed html-minifier options and inspect the fs.js:193 isFileType stack frame, followed by fs.js:380 readFileSync. Narrow the failure to a minimal HTML input or option, then verify that the same Angular SSR page no longer throws this TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, javascript, node.js
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100