Hello I've come across a problem when trying to link an NPM package.
cd my-package
npm link
npm install
npm run build
cd my-project
// cat package.json // my-package is installed from remote host but I am going to npm link it next step.
npm link my-package
npm run start (an electron application)
When my application builds the electron application finds my-project/node_modules/.vite/deps/my-package which is a cached version of the package I think because of the package.json even though I have used npm link.
The issue is:
- I do the npm linking steps
- I
rm -rf node_modules - I start my project
- It loads the linked package
- I close the app
- I boot the app
- The application now loads from
my-project/node_modules/.vite/deps/my-packagewhich is not my linked package! - On application boot 0th, it will read from my linked package
- On application boot N+1, it will read from the
.vite/depswhich I cannot control?
My work around is doing
// in package.json
{
"my-package":"file:..<path-on-disk>"
}
Why if I have the package installed in my-project can't I do a npm link for that package and have it work?
Why does vite look at the wrong package?
- It looks at
my-project/node_modules/.vite/deps/my-packageinstead ofmy-project/node_modules/my-package. This is wrong. I used my npm link version not some "cached" version I didn't request.