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:
JavaScript
x
3
1
<div id="start">start</div>
2
<div id="end">end</div>
3
JavaScript:
JavaScript
1
6
1
import LeaderLine from 'leader-line'
2
const myLine = new LeaderLine(
3
document.getElementById('start'),
4
document.getElementById('end')
5
);
6
And I simply got this error message:
JavaScript
1
2
1
TypeError: leader_line__WEBPACK_IMPORTED_MODULE_9___default.a is not a constructor
2
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:
JavaScript
1
6
1
import LeaderLine from 'leader-line-new';
2
const myLine = new LeaderLine(
3
document.getElementById('start'),
4
document.getElementById('end')
5
);
6