Code Monkey home page Code Monkey logo

Comments (3)

zkochan avatar zkochan commented on June 12, 2024

This won't work. Node.js resolves symlinks to their real locations, so peer dependencies will resolved from the same place. It doesn't matter what packages will be in the node_modules near the symlinks, node.js will ignore that node_modules during resolution.

from pnpm.

yacoubb avatar yacoubb commented on June 12, 2024

That makes sense, glad I didn't start working on that before your reply! So the hard linking is required for peer dependnecies to be resolved properly.
I think the description on the pnpm website is a tad misleading:

you can modify the source code of the linked package, and the changes will be reflected in your project

Might be helpful to mention that transpiled code / newly added files will not be updated until re-running pnpm install

For others reading this in the future, an alternative solution I considered was some kind of watcher in the consuming service that listens for file changes directly in the linked package directory, and re-applies the hard link each time a change is detected.

It sounds like running install each time we make a change is our best bet, so happy to close this.

from pnpm.

yacoubb avatar yacoubb commented on June 12, 2024

A bit more paper trail, I've been trying bun with workspaces, and it's worked pretty well so far. I can compile my code in a workspace-linked package and the changes are immediately visible in consuming packages.
I wasn't able to get the same behaviour in pnpm because the .pnpm store seemed to be installing a singleton package in two different locations (the hash at the end was different), even though all of the packages in the peerDependency descriptor inside node_modules were exactly the same.

from pnpm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.