D
D
Daniil Popov2021-04-07 11:09:17
JavaScript
Daniil Popov, 2021-04-07 11:09:17

How to use modules from parent package in child?

There is a package in the structure of which part of the functionality is placed in separate packages. How to organize so that child packages do not download all dependencies into node_modules, but only those that are not in the dependencies of the parent? The rest, respectively, were taken from the parent node_modules.
What other ways are there to not fill all the free space with duplicate modules?

Structure Example

parent-package
|- childs
   |- child-package-1
      |- ...
      |- package.json
   |- child-package-2
      |- ...
      |- package.json
|- ...
|- package.json

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2021-04-07
@Kozack

Might help:
https://docs.npmjs.com/cli/v7/using-npm/workspaces

A
Alexey Yarkov, 2021-04-07
@yarkov

https://habr.com/ru/company/yandex/blog/469021/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question