mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-19 04:26:01 +08:00
Circular dependencies, like `app.module.ts` importing `app.component.ts` which in turn imports `app.module.ts`, now display a warning during builds: ``` kamik@T460p MINGW64 /d/sandbox/master-project (master) $ ng build Hash: 3516b252f4e32d6c5bb8 Time: 8693ms chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 160 kB {4} [initial] [rendered] chunk {1} main.bundle.js, main.bundle.js.map (main) 5.95 kB {3} [initial] [rendered] chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 10.5 kB {4} [initial] [rendered] chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 1.88 MB [initial] [rendered] chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered] WARNING in Circular dependency detected: src\app\app.module.ts -> src\app\app.component.ts -> src\app\app.module.ts WARNING in Circular dependency detected: src\app\app.component.ts -> src\app\app.module.ts -> src\app\app.component.ts ``` It is important to detect and eliminate circular dependencies because leaving them in might lead to `Maximum call stack size exceeded` errors, or imports being `undefined` at runtime. To remove these warnings from your project you can factor out the circular dependency into a separate module. For instance, if module A imports `foo` from module B, and module B imports `bar` from module A, it is enough to extract `foo` into module C. You can turn off these warnings by running ng set apps.0.hideCircularDependencyWarnings=true. This will add the "hideCircularDependencyWarnings": true value to your .angular-cli.json and disable the warnings. Fix #6309 Fix #6739
5.8 KiB
5.8 KiB
Angular CLI Config Schema
Options
-
project: The global configuration of the project.
- name (
string
): The name of the project. - ejected(
boolean
): Whether or not this project was ejected. Default isfalse
.
- name (
-
apps (
array
): Properties of the different applications in this project.- name (
string
): Name of the app. - root (
string
): The root directory of the app. - outDir (
string
): The output directory for build results. Default isdist/
. - assets (
array
): List of application assets. - deployUrl (
string
): URL where files will be deployed. - index (
string
): The name of the start HTML file. Default isindex.html
- main (
string
): The name of the main entry-point file. - polyfills (
string
): The name of the polyfills entry-point file. Loaded before the app. - test (
string
): The name of the test entry-point file. - tsconfig (
string
): The name of the TypeScript configuration file. Default istsconfig.app.json
. - testTsconfig (
string
): The name of the TypeScript configuration file for unit tests. - prefix (
string
): The prefix to apply to generated selectors. - serviceWorker (
boolean
): Experimental support for a service worker from @angular/service-worker. Default isfalse
. - hideCircularDependencyWarnings (
boolean
): Hide circular dependency warnings on builds. Default isfalse
. - styles (
string|array
): Global styles to be included in the build. - stylePreprocessorOptions : Options to pass to style preprocessors.
- includePaths (
array
): Paths to include. Paths will be resolved to project root.
- includePaths (
- scripts (
array
): Global scripts to be included in the build. - environmentSource (
string
): Source file for environment config. - environments (
object
): Name and corresponding file for environment config.
- name (
-
e2e: Confirguration for end-to-end tests.
- protractor
- config (
string
): Path to the config file.
- config (
- protractor
-
lint (
array
): Properties to be passed to TSLint.- files (
string|array
): File glob(s) to lint. - project (
string
): Location of the tsconfig.json project file. Will also use as files to lint if 'files' property not present. - tslintConfig (
string
): Location of the tslint.json configuration. Default istslint.json
. - exclude (
string|array
): File glob(s) to ignore.
- files (
-
test: Configuration for unit tests.
- karma
- config (
string
): Path to the karma config file.
- config (
- codeCoverage
- exclude (
array
): Globs to exclude from code coverage.
- exclude (
- karma
-
defaults: Specify the default values for generating.
- styleExt (
string
): The file extension to be used for style files. - poll (
number
): How often to check for file updates. - class: Options for generating a class.
- spec (
boolean
): Specifies if a spec file is generated. Default isfalse
.
- spec (
- component: Options for generating a component.
- flat (
boolean
): Flag to indicate if a dir is created. Default isfalse
. - spec (
boolean
): Specifies if a spec file is generated. Default istrue
. - inlineStyle (
boolean
): Specifies if the style will be in the ts file. Default isfalse
. - inlineTemplate (
boolean
): Specifies if the template will be in the ts file. Default isfalse
. - viewEncapsulation (
string
): Specifies the view encapsulation strategy. Can be one ofEmulated
,Native
orNone
. - changeDetection (
string
): Specifies the change detection strategy. Can be one ofDefault
orOnPush
.
- flat (
- directive: Options for generating a directive.
- flat (
boolean
): Flag to indicate if a dir is created. Default istrue
. - spec (
boolean
): Specifies if a spec file is generated. Default istrue
.
- flat (
- guard: Options for generating a guard.
- flat (
boolean
): Flag to indicate if a dir is created. Default istrue
. - spec (
boolean
): Specifies if a spec file is generated. Default istrue
.
- flat (
- interface: Options for generating a interface.
- prefix (
string
): Prefix to apply to interface names. (i.e. I)
- prefix (
- module: Options for generating a module.
- flat (
boolean
): Flag to indicate if a dir is created. Default isfalse
. - spec (
boolean
): Specifies if a spec file is generated. Default isfalse
.
- flat (
- pipe: Options for generating a pipe.
- flat (
boolean
): Flag to indicate if a dir is created. Default istrue
. - spec (
boolean
): Specifies if a spec file is generated. Default istrue
.
- flat (
- service: Options for generating a service.
- flat (
boolean
): Flag to indicate if a dir is created. Default istrue
. - spec (
boolean
): Specifies if a spec file is generated. Default istrue
.
- flat (
- serve: Properties to be passed to the serve command
- port (
number
): The port the application will be served on. Default is4200
. - host (
string
): The host the application will be served on. Default islocalhost
. - ssl (
boolean
): Enables ssl for the application. Default isfalse
. - sslKey (
string
): The ssl key used by the server. Default isssl/server.key
. - sslCert (
string
): The ssl certificate used by the server. Default isssl/server.crt
.
- port (
- styleExt (
-
packageManager (
string
): Specify which package manager tool to use. Options includenpm
,cnpm
andyarn
. -
warnings: Allow people to disable console warnings.
- nodeDeprecation (
boolean
): Show a warning when the node version is incompatible. Default istrue
. - packageDeprecation (
boolean
): Show a warning when the user installed angular-cli. Default istrue
. - versionMismatch (
boolean
): Show a warning when the global version is newer than the local one. Default istrue
.
- nodeDeprecation (