tiptap-math-extension icon indicating copy to clipboard operation
tiptap-math-extension copied to clipboard

Package unavailable at jspm

Open bjhess opened this issue 1 year ago • 1 comments

I wanted to share this in case it relates to any real issues with the library. Feel free to close it with "not our problem" though!

I am using Tiptap via Rhino and Rails. Specifically I am loading libraries with Import Maps. I couldn't pin this extension in my usual way:

> bin/importmap pin "@aarkue/tiptap-math-extension"                
Couldn't find any packages in ["@aarkue/tiptap-math-extension"] on jspm

Nor did jsdelivr work

> bin/importmap pin "@aarkue/tiptap-math-extension" --from jsdelivr
Couldn't find any packages in ["@aarkue/tiptap-math-extension"] on jsdelivr

unpkg did work:

> bin/importmap pin "@aarkue/tiptap-math-extension" --from unpkg   
Pinning "@aarkue/tiptap-math-extension" to https://unpkg.com/@aarkue/[email protected]/dist/index.js

Leading to this in my importmap.rb file:

pin "@aarkue/tiptap-math-extension", to: "https://unpkg.com/@aarkue/[email protected]/dist/index.js"
pin "evaluatex/dist/evaluatex", to: "https://unpkg.com/[email protected]/dist/evaluatex"
pin "katex", to: "https://unpkg.com/[email protected]/dist/katex.mjs"

I visited https://generator.jspm.io to see if I could cobble together a jspm entry manually. I searched for "@aarkue/tiptap-math-extension" and here's what I saw: CleanShot 2024-12-10 at 10 19 04@2x

Error: No './dist/evaluatex' exports subpath defined in https://ga.jspm.io/npm:[email protected]/ resolving evaluatex/dist/evaluatex imported from https://ga.jspm.io/npm:@aarkue/[email protected]/dist/index.js.

In case it's helpful, this seems a bit similar to my challenges importing MathExtension when loading up Rhino/Tiptap. Snippet from my rhino_controller.js file:

import MathExtension from "@aarkue/tiptap-math-extension"
...
rhino.addExtensions([MathExtension])

In the browser:

Failed to register controller: rhino (controllers/rhino_controller) SyntaxError: The requested module 'evaluatex/dist/evaluatex' does not provide an export named 'default'

bjhess avatar Dec 10 '24 16:12 bjhess

Thanks for reporting this! I am not familiar with jspm, but I will try to look into it when I find the time.

aarkue avatar Dec 20 '24 08:12 aarkue