Angular common library

Discussão em 'Angular' iniciado por tony, Outubro 23, 2024.

  1. tony

    tony Guest

    I have two applications that I want to keep separate, and I want them to share common code. I've tried a few approaches


    1. I made a common library in the same workspace as one of the applications. I noticed that within Visual Studio I could see the applications code in the library. That would get confusing quickly


    2. I made a common library in a different workspace. I then included it via

    npm install "file://../../CommonLib/ClientApp/dist/common-lib/main"

    but it seems like npm/webpack/angular is looking at the version number to see if the file has changed and not picking up changes during development

    1. I had also previously used npm pack to make a node_module package, but that had the caching issues as well as you would expect

    What do I want? I want the same as I have in C#. A common library that can't see the code from the applications in any way, that we can change easily enough and that the applications can use

    I have tried AI which suggested adding a unique hash, which seems like a bit of a hack

    Continue reading...

Compartilhe esta Página