Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure dependencies are available for any consuming project that locally links the SDK #1100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented May 26, 2023

Make sure dependencies are available for any consuming project that locally links the SDK

Unfortunately, if you npm link hydrogen-view-sdk in another project, it won't install any of the child dependencies of hydrogen-view-sdk on it's own. And will actually remove any child dependencies if you previously had hydrogen-view-sdk installed from npm and then linked the project.

Why should we do this?

I was seeing this problem with the Matrix Public Archive where when locally linking via npm link hydrogen-view-sdk, all of the child dependencies like another-json weren't being found when Vite was bundling things because npm was removing those dependencies when linking and Vite doesn't resolve from ../hydrogen-web/node_modules

This definitely seems like the responsibility of npm to handle but it seems like they're not interested in fixing this. Essentially a bug in npm in my opinion.

I tried the workaround mentioned in npm/cli#2339 (comment) which is to use npm install --install-links ../hydrogen-web/target but it doesn't create a symlink (whereas npm install ../hydrogen-web/target creates a symlink) and it wrecks the monorepo file:./share dependency that we also have. (using npm@9.5.1 which comes with Node.js v18.16.0)

All this to say, it's probably easier for people to avoid all this pain and not have to think about any of this if we just install node_modules/ for them.

…ocally links the SDK

Unfortunately, if you `npm link hydrogen-view-sdk` in another project,
it won't install any of the child dependencies of `hydrogen-view-sdk` on
it's own. And will actually remove any child dependencies if you previously
had `hydrogen-view-sdk` installed from npm and then linked the project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant