Is there a way to "au run" a project installed with no npm dependencies?

In au new, if we answer the question:

Would you like to install all the npm dependencies? · No

then the installation is extremely fast.

But then the au run fails because it can’t find the depends

I was wondering if there is way to run a set of “no dependencies” projects by “linking” it to a common installation.

From a common installation, one could modify the srcdir in webpack.config.js to point to another src (and then add the config folder structure in …). But this only works with one project at a time.

1 Like

This can be achieved a number of ways such as installing all dependencies globally or shared node_modules folder using NODE_PATH but I would recommend against doing this as it hurts the portability of the code base. If you move to another machine, run an automated build, or need to share the code with a colleague then they must also set the project up a similar way.

Subsequent installations after the first should go more quickly because packages are cached by default but it will likely never be negligible because modules still need copied around the file system. I suggest using solid state storage and having projects on the same drive where the node cache is.

You can also consider using another package manager such as pnpm which uses symlinks to share duplicate packages to save disk space or yarn which seems to be slightly more efficient than npm in general.

1 Like