How to import thrid party js libraries in vue.js?

Viewed 64

Following is the code for using svg.js library in vue.js

I'm being able to use it's some plugins like draggable, panzoom, filter etc... (here are the plugins https://svgjs.dev/docs/3.1/plugins/)

Is there a way to use svg.path.js plugin?

import '@svgdotjs/svg.draggable.js';

import { SVG } from '@svgdotjs/svg.js';


export default {
  name: 'svg',
  components: {},
  props: [],
  data() {
    return {
    };
  },
  computed: {
  },
mounted() {
    var draw = SVG().addTo('body');
      draw
        .rect(150, 75)
        .move(100 , 50 )
        .radius(5)
}
}

Similarly is there a way for me to import svg.path.js in to vue js somehow and use it?

Here are some insights i found on stackoverflow:

How do i use SVG.js plugins in vue.js?

this is that library : https://www.npmjs.com/package/svg.path.js

I've tried importing it this way: import 'svg.path.js'

But I'm getting error This dependency was not found:

NOTE

Or is there a way to import js files directly in to vue.js? Please share.

0 Answers
Related