[Vuejs]-How to use imports globally in Vue-Application?

0πŸ‘

βœ…

In case if you want to use styles file globally you can import it inside your App.vue in style section.

<style lang="scss">
//your imports here
</style

If you want to import js files globally you can do it in your main.js file

In vue2 vue plugins are connected in this way:

import Vue from "vue";
import PluginName from "pulin-name";

Vue.use(PluginName);

For vue3 use:

import { createApp } from "vue";
import PluginName from "plugin-name";

const app = createApp(...);
app.use(PluginName);

Correct way should be described in plugin documentation, so read it before start to use in your project.

Leave a comment