Does anyone know how to specify the NODE_PATH for a vue-cli app? I've tried setting a NODE_PATH environment variable from within my app folder but no luck.
My goal is to move the node_modules folder a couple of directories up as I will be using multiple vue-cli apps and would like to reuse the 180M worth of code for each app!
I've also tried setting the NODE_PATH in package.json but still no luck.
My understanding is that node will look for the modules in the parent directory but it is not working. If someone has a working example with vue-cli specifically, that would be appreciated.
I got it working however I'm not sure if is a best practice. Seems like vue-cli needs a local package to initialize.
So I placed a copy of the node_modules folder in the parent directory and deleted all the packages from my app's node_modules folder, except for the @vue folder and the hidden .bin folder.
Vue uses the local vue-cli package to initialize and then traverses up to the parent folder when it can't find the other dependencies.
This now allows me to have multiple vue-cli apps reusing a single set of default packages. If any of my apps need additional dependencies, I will just install them locally, per app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With