question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to run mathlive for VueJS with package from node_module

See original GitHub issue

Description

I still have this problem when i reproduce the example for VueJs

in main.js

import MathLive from 'mathlive/dist/mathlive';
import Mathfield from 'mathlive/dist/vue-mathlive.mjs';
Vue.use(Mathfield, MathLive);

In my math component

<mathlive-mathfield id="mf" ref="mathfield" :config="{smartFence:false}" v-on:focus="ping"
            :on-keystroke="displayKeystroke" v-model="formula">f(x)=</mathlive-mathfield>

gives this error

TypeError: Cannot read property '0' of undefined

Capture d’écran 2020-11-03 à 17 31 34

Environment

Operating System MacOS

Browser Chrome

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
arnogcommented, Nov 4, 2020

Hmmm… I think the warning at the top might be relevant: “You are using the runtime-only build of Vue…”. It appears that the element that the Mathfield builds on (this.element) is not an HTMLElement but some comment node (!?) Try including the Vue runtime with its compiler.

0reactions
arnogcommented, Nov 12, 2020

Good catch regarding the documentation. The options used to be called config and the README file had not been updated. Done now.

I don’t know what you mean regarding from a folder that is public. When setting the fontsDirectory option it can be either a relative path (which is relative to the location of the mathlive.mjs file) or a fully qualified URL (e.g. http://myserver.com/assets/fonts) or if you’re executing locally, a local directory, i.e. file://my-drive/my-projects/node_modules/myproject/fonts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node modules won't import in my Vue.js project - Stack Overflow
Show activity on this post. I'm trying to import a node module installed through NPM inside a Vue. js single file component. Every...
Read more >
Building external modules in VueJS - Pusher Blog
In the sample code above, you can see where the package is imported as PreviewComponent . After it's imported, it's linked to the...
Read more >
Packaging Vue Components for npm
By packaging your component to be shared via npm, ... Can't I Just Share .vue Files Directly? ... “Why can't people use my...
Read more >
开发工具 - 超级架构师
Delightful Node.js packages and resources https://node.cool ... SwiftQueue - Job Scheduler with Concurrent run, failure/retry, persistence, repeat, ...
Read more >
Vue.js - How to Build Your First Package & Publish It on NPM
We'll learn how to make our own plugin for Vue.js, and distribute it on NPM for everyone to use.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found