html-minifier icon indicating copy to clipboard operation
html-minifier copied to clipboard

TypeError: Cannot read property '1' of undefined

Open SDAdham opened this issue 3 years ago • 1 comments

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.

SDAdham avatar May 14 '22 12:05 SDAdham

const minify = require('html-minifier').minify; doesn't work import { minify } from 'html-minifier'; also is not working

SDAdham avatar May 14 '22 15:05 SDAdham