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

Error: "detector2 is not a function" when importing mermaid-zenuml #109

Open
reubenfirmin opened this issue Dec 14, 2023 · 1 comment
Open
Assignees

Comments

@reubenfirmin
Copy link

I'm importing mermaid-zenuml into a kotlinjs project, and get an error when passing it to registerExternalDiagrams:

r2 is not a function', message: 'detector2 is not a function', hash: 'TypeError', error: TypeError: detector2 is not a function
    at detectType (webpack-internal:///../../node_modules/me…}error: TypeError: detector2 is not a function
    at detectType (webpack-internal:///../../node_modules/mermaid/dist/mermaid-934d9bea.js:2420:22)
    at getDiagramFromText (webpack-internal:///../../node_modules/mermaid/dist/mermaid-934d9bea.js:3724:17)
    at Object.render$1 [as render] (webpack-internal:///../../node_modules/mermaid/dist/mermaid-934d9bea.js:6044:18)
    at eval (webpack-internal:///../../node_modules/mermaid/dist/mermaid-934d9bea.js:6346:18)
    at new Promise (<anonymous>)
    at performCall (webpack-internal:///../../node_modules/mermaid/dist/mermaid-934d9bea.js:6345:31)
    at executeQueue (webpack-internal:///../../node_modules/mermaid/dist/mermaid-934d9bea.js:6314:15)
    at eval (webpack-internal:///../../node_modules/mermaid/dist/mermaid-934d9bea.js:6361:5)
    at new Promise (<anonymous>)
    at render (webpack-internal:///../../node_modules/mermaid/dist/mermaid-934d9bea.js:6344:10)hash: "TypeError"message: "detector2 is not a function"str: "detector2 is not a function"[[Prototype]]: Objectconstructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()__defineGetter__: ƒ __defineGetter__()__defineSetter__: ƒ __defineSetter__()__lookupGetter__: ƒ __lookupGetter__()__lookupSetter__: ƒ __lookupSetter__()__proto__: (...)get __proto__: ƒ __proto__()set __proto__: ƒ __proto__()

Dumping out what I'm registering to console.log right before the call, I get:

{id: 'zenuml', detector: ƒ, loader: ƒ}
detector : (txt) => { return /^\s*zenuml/.test(txt); }
id : "zenuml"
loader :  async () => {…}
[[Prototype]] : Object

...so I'm pretty sure it's not a case of mangled names.

Is https://www.npmjs.com/package/@mermaid-js/mermaid-zenuml up to date enough?

One note is that I had to mangle the import path to get a clean module mapping:

@JsModule("@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.core.mjs")
@JsNonModule
external val ZenUML: ExternalDiagram
@dontry
Copy link
Collaborator

dontry commented Jan 28, 2024

Hi @reubenfirmin, have you resolved this issue? If not, I would like to assist. Can you please provide the version information for mermaid, specifically @mermaid-js/mermaid-zenuml? I apologize for my limited knowledge of KotlinJS. Would you mind running mermaid-zenuml in a node project first to see if it works for you? This will help me identify the problem.

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

2 participants