I am working on a project that requires using a js plugin. Now that we're using vue and we have a component to handle the plugin based logic, I need to import the js plugin file within the vue component in order to initialize the plugin.
Previously, this was handled within the markup as follows:
<script src="//api.myplugincom/widget/mykey.js
"></script>
This is what I tried, but I am getting a compile time error:
MyComponent.vue
import Vue from 'vue';
import * from '//api.myplugincom/widget/mykey.js';
export default {
data: {
My question is, what is the proper way to import this javascript file so I can use it within my vue component? ...
npm
/webpack
... ? And which lib do you require, internal / external ? – Antigoriteimport something from path
. Path is resolve at compile time so you need to reference a file in your local directory. Not the end of an URI. – Antigoriteimport * as myModule from '//api.myplugincom/widget/mykey.js';
also, yourpath
is wrong – Lavern