Skip to content

TypeError: hljs.getLanguage is not a function with highlight.js v11 under bundler moduleResolution #756

@physphile

Description

@physphile

Package version

v4.57.7

Node version

v18.19.1

Platform

No response

What steps will reproduce the bug?

const getHtmlContent = (value: string) => {
  try {
    const { result } = transform(value, {
      allowHTML: true,
      disableCommonAnchors: true,
    });

    return result.html;
  } catch (error) {
    // TypeError: hljs.getLanguage is not a function
  }
};

What is the expected behavior?

Transform returns valid html

What do you see instead?

I see error, markdown breaks

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions