Skip to content
Advertisement

Using Leader Line on VueJS

I am trying to download and run Leader Line on VueJS and had a few issues that were open online but with no absolute solution.

I have installed leader-line via npm – npm install leader-line

Then this is my code for the vuejs file.

HTML:

<div id="start">start</div>
<div id="end">end</div>

JavaScript:

import LeaderLine from 'leader-line'
const myLine = new LeaderLine(
     document.getElementById('start'),
     document.getElementById('end')
);

And I simply got this error message:

TypeError: leader_line__WEBPACK_IMPORTED_MODULE_9___default.a is not a constructor

Any help would be extremely appreciated, thank you!

Advertisement

Answer

Leader Line package cannot be imported as discussed in this GitHub issue.

An updated package is available here: Leader Line New. This package is just the anseki version with imports and types.

The javascript in your case looks like this:

import LeaderLine from 'leader-line-new';
const myLine = new LeaderLine(
     document.getElementById('start'),
     document.getElementById('end')
);
Advertisement