I’d like to add my two cents here: NPM v7 finally includes a “workspaces” feature to natively deal with multi-package scenarios (yarn had workspaces built-in for a longer time already). In a Frontity project, this allows me to add
to my root
package.json and be happy ever after NPM automatically installs all packages from the
packages folder, symlinks them accordingly and dedupes duplicate dependencies into the root
node-modules folder. Hence I can remove all the
"@frontity/mars-theme": "./packages/mars-theme"-style local references and, moreover, I can also directly
npm install dependencies in a package subdirectory.
There is one drawback as of now which I have not investigated further: After running
npm install whatever-dependency in a package subdirectory, I have to run
npm install in the root directory again or React welcomes me with a rules-of-hooks error message on the next
npm run dev. Maybe this step is required for NPM to dedupe packages again (?). This seems more like an NPM-workspaces-related problem to me, however, and could possibly also be circumvented by automatically
npm installing the root package on
npm run dev.
In any way, I’d like to keep my package’s
node_modules folders if possible, in order to keep using the