2

I am new to vue js and currently trying to import any vue plugin/component into other sfc .vue files for usage.

Currently I am using VS code with vue create project cli setup and in my main App.vue file I am trying to import plugin after installation via npm.

I have came across this code at many places but not sure from where this has been imported. Also not sure how this path system works?

import SomePlugin from 'some-plugin';

My guess is that this comes inside node_modules folder after npm install cli part. Do we need to include full path of node_modules folder or vue-cli handles this automatically as full path looks weird.

import SomePlugin from '../node_modules/some-plugin';

1 Answer 1

5

Importing using only the package name will always look in the node_modules folder, regardless of whether the node_modules is in the current directory, the parent directory, or the global directory. Unless if the path is preceded by ./, ../, etc.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.