4

I am using AngularCLI (ng) version 1.6.7. I am getting some compilation from internal libraries that I don't control, for example:

https://github.com/angular/material2/issues/9816

ERROR in node_modules/@angular/material/expansion/typings/expansion-panel.d.ts(36,14): error TS2314: Generic type 'TemplatePortal<C>' requires 1 type argument(s).
node_modules/@angular/material/tabs/typings/tab-body.d.ts(62,15): error TS2314: Generic type 'TemplatePortal<C>' requires 1 type argument(s).
node_modules/@angular/material/tabs/typings/tab.d.ts(28,23): error TS2314: Generic type 'TemplatePortal<C>' requires 1 type argument(s).

Because of this compilation error, the dist directory won't even get written out, so I'm dead in the water. Is there some flag I can use with ng build -w so that compilation errors are ignored - perhaps compilation errors outside of my codebase?

Something like:

ng build -w -i # where -i ignores errors

I tried ng build --help and I see:

ng build --help
ng build <options...>
  Builds your app and places it into the output path (dist/ by default).
  aliases: b
  --target (String) (Default: development) Defines the build target.
    aliases: -t <value>, -dev (--target=development), -prod (--target=production), --target <value>
  --environment (String) Defines the build environment.
    aliases: -e <value>, --environment <value>
  --output-path (Path) Path where output will be placed.
    aliases: -op <value>, --outputPath <value>
  --aot (Boolean) Build using Ahead of Time compilation.
    aliases: -aot
  --sourcemaps (Boolean) Output sourcemaps.
    aliases: -sm, --sourcemap, --sourcemaps
  --vendor-chunk (Boolean) Use a separate bundle containing only vendor libraries.
    aliases: -vc, --vendorChunk
  --common-chunk (Boolean) (Default: true) Use a separate bundle containing code used across multiple bundles.
    aliases: -cc, --commonChunk
  --base-href (String) Base url for the application being built.
    aliases: -bh <value>, --baseHref <value>
  --deploy-url (String) URL where files will be deployed.
    aliases: -d <value>, --deployUrl <value>
  --verbose (Boolean) (Default: false) Adds more details to output logging.
    aliases: -v, --verbose
  --progress (Boolean) (Default: true) Log progress to the console while building.
    aliases: -pr, --progress
  --i18n-file (String) Localization file to use for i18n.
    aliases: --i18nFile <value>
  --i18n-format (String) Format of the localization file specified with --i18n-file.
    aliases: --i18nFormat <value>
  --locale (String) Locale to use for i18n.
    aliases: --locale <value>
  --missing-translation (String) How to handle missing translations for i18n.
    aliases: --missingTranslation <value>
  --extract-css (Boolean) Extract css from global styles onto css files instead of js ones.
    aliases: -ec, --extractCss
  --watch (Boolean) (Default: false) Run build when files change.
    aliases: -w, --watch
  --output-hashing=none|all|media|bundles (String) Define the output filename cache-busting hashing mode.
    aliases: -oh <value>, --outputHashing <value>
  --poll (Number) Enable and define the file watching poll time period (milliseconds).
    aliases: -poll <value>
  --app (String) Specifies app name or index to use.
    aliases: -a <value>, -app <value>
  --delete-output-path (Boolean) (Default: true) Delete output path before build.
    aliases: -dop, --deleteOutputPath
  --preserve-symlinks (Boolean) (Default: false) Do not use the real path when resolving modules.
    aliases: --preserveSymlinks
  --extract-licenses (Boolean) (Default: true) Extract all licenses in a separate file, in the case of production builds only.
    aliases: --extractLicenses
  --show-circular-dependencies (Boolean) (Default: true) Show circular dependency warnings on builds.
    aliases: -scd, --showCircularDependencies
  --build-optimizer (Boolean) Enables @angular-devkit/build-optimizer optimizations when using `--aot`.
    aliases: --buildOptimizer
  --named-chunks (Boolean) Use file name for lazy loaded chunks.
    aliases: -nc, --namedChunks
  --subresource-integrity (Boolean) (Default: false) Enables the use of subresource integrity validation.
    aliases: -sri, --subresourceIntegrity
  --bundle-dependencies (none, all) (Default: none) Available on server platform only. Which external dependencies to bundle into the module. By default, all of node_modules will be kept as requires.
    aliases: --bundleDependencies <value>
  --service-worker (Boolean) (Default: true) Generates a service worker config for production builds, if the app has service worker enabled.
    aliases: -sw, --serviceWorker
  --skip-app-shell (Boolean) (Default: false) Flag to prevent building an app shell
    aliases: --skipAppShell
  --stats-json (Boolean) (Default: false) Generates a `stats.json` file which can be analyzed using tools such as: `webpack-bundle-analyzer` or https://webpack.github.io/analyse.
    aliases: --statsJson
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
  • I am not seeing a relevant option in the help list – Alexander Mills Feb 07 '18 at 00:35
  • there must be a way to ignore errors originating from node_modules? – Alexander Mills Feb 07 '18 at 00:55
  • That's the typescript compiler complaining, which the Angular CLI is using under the hood. I doubt you can just "ignore" the errors, but you'd have to look at `tsc` options, not `ng build` options to find something like that. It might be easier to just try to find the source of the errors. @angular/material is reputable package, I would imagine it's possible to fix by tweaking some version numbers. – matmo Feb 10 '18 at 02:29

1 Answers1

0

You should install the correct version of @angular/cdk@5.1.1.

See this link.

Alessander França
  • 2,697
  • 2
  • 29
  • 52
  • 1
    yes I think `@angular/cdk` should be the same version as `@angular/cli` – Alexander Mills Feb 16 '18 at 18:39
  • 2
    nah unfortunately this is probably not the answer I am looking for.. I was hoping for a flag that can build apps even if they can't compile although that flag likely does not exist. It depends on the compilation error, some errors cannot be ignored, like a bad import statement. – Alexander Mills Feb 16 '18 at 18:51