Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

vue js import from node_modules

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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';

>Solution :

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. I think.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading