Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property '1' of undefined #1130

Open
SDAdham opened this issue May 14, 2022 · 1 comment
Open

TypeError: Cannot read property '1' of undefined #1130

SDAdham opened this issue May 14, 2022 · 1 comment

Comments

@SDAdham
Copy link

SDAdham commented May 14, 2022

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
Copy link
Author

SDAdham commented May 14, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant