Skip to content

larixer/peer-workspaces-and-preserve-symlinks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Workspace peer dependencies and --preserve-symlinks demo

This demo project shows how --preserve-symlinks Node flag lets the application use proper peer dependencies for workspaces

We have the following project layout:

.
├── ws1
│   └── dependencies
│       ├── button@workspace:*
│       └── [email protected]
├── ws2
│   └── dependencies
│       ├── button@workspace:*
│       └── [email protected]
└── button
    └── peerDependencies
        └── is-number@*

And we want that button workspace used correct is-number peer dependency version, which is different in workspaces ws1 and ws2. Given the fact that the project uses node_modules the button is represented as a symlink in each of the workspaces. If Node.js is used with default flags, only one version of is-number will be used in both workspaces, e.g. peer dependency contract will be violated, this can be seen by running:

node ./index.js

But if we run:

node --preserve-symlinks ./index.js

The correct is-number version will be used by button in each of the workspaces.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published