Preserve Symlinks in Angular Libraries

17,941

I believe you need to add the preserveSymlinks option in the angular.json located at the project that will consume your library. For instance, I was testing locally, and I added it in my architect -> build -> options.

You will able to find more info here: https://dev.to/nieds/getting-started-building-component-libraries-with-angular-cli-4ncj

Hope this helps!

Share:
17,941
andersonbalves
Author by

andersonbalves

Software Engineer, developer of frameworks and web applications. Development experience using J2EE, Angular, Spring and other technologies.

Updated on June 18, 2022

Comments

  • andersonbalves
    andersonbalves almost 2 years

    I have a problem.

    I'm trying to make a Angular 8 Library using ng-cli, but i can't preserve symlinks from my external application using npm link.

    I've tried to add this on my angular.json:

        "build": {
          "builder": "@angular-devkit/build-ng-packagr:build",
          "options": {
            "preserveSymlinks": true,
            "tsConfig": "projects/button/tsconfig.lib.json",
            "project": "projects/button/ng-package.json"
          }
        }, 
    

    but got:

    "Schema validation failed with the following errors: Data path ""
    should NOT have additional properties(preserveSymlinks)."
    

    I found that it doesn't work for libraries.

    Then I tried to add this to my tsconfig.lib.json:

     "angularCompilerOptions": {
        "annotateForClosureCompiler": true,
        "skipTemplateCodegen": true,
        "strictMetadataEmit": true,
        "fullTemplateTypeCheck": true,
        "strictInjectionParameters": true,
        "enableResourceInlining": true,
        "preserveSymlinks": true
      }
    

    And nothing happend.

    I searched here for a solution, but couldn't find anything like it.

    How can I make it?

    Thank you!