Skip to content

Current browser assets not strict-mode safe (langApiRestored) #2234

@masx200

Description

@masx200

In strict mode, running 'highlight.min.js' will throw an error.
Probably because the official compression destroys the properties of some objects
The file version obtained from the npm repository is different from the file obtained from other cdn repositories

import('https://cdn.staticfile.org/highlight.js/9.15.10/highlight.min.js').catch(console.error)
TypeError: Cannot create property 'langApiRestored' on string 'self'
    at i (highlight.min.js:2)
    at Array.forEach (<anonymous>)
    at i (highlight.min.js:2)
    at Array.forEach (<anonymous>)
    at i (highlight.min.js:2)
    at Array.forEach (<anonymous>)
    at i (highlight.min.js:2)
    at Array.forEach (<anonymous>)
    at i (highlight.min.js:2)
    at Object.n.registerLanguage (highlight.min.js:2)
    function i(e) {
        if (a && !e.langApiRestored) {
            for (var t in e.langApiRestored = !0,
            a)
                e[t] && (e[a[t]] = e[t]);
            (e.c || []).concat(e.v || []).forEach(i)
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    help welcomeCould use help from communitypackage/buildIssues relating to npm or packaging

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions