0

In general I have several projects that I want to share components with. I do need the development to be fast, and if I create a library project, then I need build and deploy every library whenever it changes.. so I decided to just create a directory with the shared components in it and dynamic link the components to the project.

I'm on MacOS Mojave 10.14 with NodeJS v10.12.0 and angular cli v7.0.2

my src/app folder has the following:

16 -rw-r--r--   1 zoharzz  staff   792 Oct 20 19:21 app-routing.module.ts
16 -rw-r--r--   1 zoharzz  staff  1173 Oct 20 19:02 app.component.html
 0 -rw-r--r--   1 zoharzz  staff     0 Oct 20 19:02 app.component.scss
16 -rw-r--r--   1 zoharzz  staff  1113 Oct 20 19:02 app.component.spec.ts
16 -rw-r--r--   1 zoharzz  staff   222 Oct 20 19:02 app.component.ts
16 -rw-r--r--   1 zoharzz  staff  1508 Oct 20 20:19 app.module.ts
 0 drwxr-xr-x   6 zoharzz  staff   204 Oct 20 19:34 car-n-details-dialog
 0 drwxr-xr-x   6 zoharzz  staff   204 Oct 20 19:34 footer-toolbar
16 -rw-r--r--   1 zoharzz  staff   647 Oct 20 19:58 graphql.module.ts
 0 drwxr-xr-x   6 zoharzz  staff   204 Oct 20 19:34 home
 0 drwxr-xr-x   6 zoharzz  staff   204 Oct 20 19:34 products
 0 drwxr-xr-x   6 zoharzz  staff   204 Oct 15 16:14 terms-page
 0 drwxr-xr-x   6 zoharzz  staff   204 Oct 20 19:39 toolbar
16 lrwxr-xr-x   1 zoharzz  staff    45 Oct 20 20:22 tuxin-ec-accessibility -> ../../../tuxin-ec-libs/tuxin-ec-accessibility
16 lrwxr-xr-x   1 zoharzz  staff    43 Oct 20 19:13 tuxin-ec-breadcrumbs -> ../../../tuxin-ec-libs/tuxin-ec-breadcrumbs
16 lrwxr-xr-x   1 zoharzz  staff    36 Oct 20 19:13 tuxin-ec-cars -> ../../../tuxin-ec-libs/tuxin-ec-cars
16 lrwxr-xr-x   1 zoharzz  staff    36 Oct 20 19:13 tuxin-ec-cart -> ../../../tuxin-ec-libs/tuxin-ec-cart
16 lrwxr-xr-x   1 zoharzz  staff    42 Oct 20 19:13 tuxin-ec-contact-us -> ../../../tuxin-ec-libs/tuxin-ec-contact-us
 0 drwxr-xr-x   3 zoharzz  staff   102 Oct 20 20:18 tuxin-ec-libs
16 lrwxr-xr-x   1 zoharzz  staff    48 Oct 20 19:35 tuxin-ec-login-management -> ../../../tuxin-ec-libs/tuxin-ec-login-management
16 lrwxr-xr-x   1 zoharzz  staff    39 Oct 20 19:13 tuxin-ec-payment -> ../../../tuxin-ec-libs/tuxin-ec-payment
16 lrwxr-xr-x   1 zoharzz  staff    39 Oct 20 19:13 tuxin-ec-product -> ../../../tuxin-ec-libs/tuxin-ec-product
16 lrwxr-xr-x   1 zoharzz  staff    42 Oct 20 19:13 tuxin-ec-validators -> ../../../tuxin-ec-libs/tuxin-ec-validators

so when I try to compile it with ng build -c development, I get:

ERROR in ../tuxin-ec-libs/tuxin-ec-accessibility/tuxin-ec-accessibility.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-accessibility/tuxin-ec-accessibility.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-breadcrumbs/tuxin-ec-breadcrumbs.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-breadcrumbs/tuxin-ec-breadcrumbs.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-cars/car-type/tuxin-ec-car-type.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cars/car-type/tuxin-ec-car-type.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-cart/cart-page/tuxin-ec-cart-page.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cart/cart-page/tuxin-ec-cart-page.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-cart/delivery-options/tuxin-ec-delivery-options.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cart/delivery-options/tuxin-ec-delivery-options.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-cart/invoice/tuxin-ec-invoice.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cart/invoice/tuxin-ec-invoice.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-cart/side-cart/tuxin-ec-side-cart.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cart/side-cart/tuxin-ec-side-cart.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-cart/tuxin-ec-cart.service.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cart/tuxin-ec-cart.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-contact-us/tuxin-ec-contact-us-graphql.service.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-contact-us/tuxin-ec-contact-us-graphql.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-contact-us/tuxin-ec-contact-us.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-contact-us/tuxin-ec-contact-us.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-login-management/login/tuxin-ec-login.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-login-management/login/tuxin-ec-login.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-login-management/tuxin-ec-user.service.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-login-management/tuxin-ec-user.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-payment/credit-card/tuxin-ec-credit-card.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-payment/credit-card/tuxin-ec-credit-card.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-payment/tuxin-ec-payment.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-payment/tuxin-ec-payment.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-product/hot-products/tuxin-ec-hot-products.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-product/hot-products/tuxin-ec-hot-products.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-product/product-card/tuxin-ec-product-card.component.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-product/product-card/tuxin-ec-product-card.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-product/tuxin-ec-category.service.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-product/tuxin-ec-category.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)
ERROR in ../tuxin-ec-libs/tuxin-ec-product/tuxin-ec-product.service.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-product/tuxin-ec-product.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
    at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at process._tickCallback (internal/process/next_tick.js:68:7)

When copy the directories into the project instead of dynamically linking them, I don't get these errors.

so... is there a way to modify angular.json so it will support using dynamically linked directories ?

this is my angular.json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "windy-client": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "tuxin-ec",
      "schematics": {
        "@schematics/angular:component": {
          "styleext": "scss"
        }
      },
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/windy-client",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                }
              ]
            },
            "development": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.dev.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "windy-client:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "windy-client:build:production"
            },
            "development": {
              "browserTarget": "windy-client:build:development"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "windy-client:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.scss"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "windy-client-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "prefix": "",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "windy-client:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "windy-client:serve:production"
            },
            "development": {
              "devServerTarget": "windy-client:serve:development"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "windy-client"
}
2
  • looks like npm install required to me. Commented Oct 20, 2018 at 17:52
  • @Antoniossss - these components are part of the project, not as libraries that I need to pack and install Commented Oct 20, 2018 at 17:53

1 Answer 1

1

opened an issue on github, it a appears I was missing a small configuration property.

this is their answer:

You should be able to do so using preserveSymlinks either via the command line or via the options inside the angular.json under architect/build/options

Ex:

"architect": {
  "build": {
    "builder": "@angular-devkit/build-angular:browser",
    "options": {
      "preserveSymlinks": true,
      "index": "src/index.html",
      "main": "src/main.ts",
      ...
    }
  }
}
Check here: https://angular.io/cli/build
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.