This PR doesn't change new projects to use 2.4 since I have seen some reports of possible problems in `@angular/*`.
Instead, it:
- removes the dependency restrictions on <2.3
- bumps related dependencies to the minimum that supports 2.4 (`rxjs@^5.4.2`, `ts-node@~3.2.0`)
- builds the CLI itself using 2.4
So if you want to install ts 2.4 in your new project, the CLI itself won't stop you.
Fix#6827
Followup to #6881
Allow controlling chunk naming via the `--named-chunks` flag, which can be set on `.angular-cli.json` as well.
Defaults to true in development, false in production.
Adds the new flag `--build-optimizer` (`--bo`), usable only with `--aot` (or `--prod` since it auto enables `--aot`).
This feature is experimental, and may not work correctly on your project. Should it work, total bundle size should go down. Savings are heavily dependent on the project.
See https://github.com/angular/devkit/tree/master/packages/angular_devkit/build_optimizer for details about all the optimizations applied.
Usage: `ng build --prod --build-optimizer`. Disabling the vendor chunk has been shown to improve total savings, and is done automatically when `--bo` is specified unless `--vendor-chunk` has a value.
Please let us know if using `--build-optimizer` breaks your project so we can improve it further. Repos are very welcome.
Adds following defaults to `.angular-cli.json` under `defaults`: `sourcemaps`, `baseHref`, `progress`, `poll`, `deleteOutputPath`, `preserveSymlinks`, `showCircularDependencies`.
They can be set via `ng set defaults.build.KEY = VALUE`.
Also removes `apps.0.showCircularDependencies`. This is not a breaking chance since it was only added in 1.3.0-beta.0.
Followup to https://github.com/angular/angular-cli/pull/6884#discussion_r125533830.
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#6309Fix#6739
A previous change broke the logic which brings an application ngsw-manifest.json into the Webpack build for merging with the auto-generated configuration. It caused the GlobCopyWebpackPlugin to look in the wrong directory for the existing manifest. This change sets the working directory for the copy plugin explicitly.
Fixes#6654.
When @angular/cli dependencies (like @ngtool/webpack for example) are installed in its node_modules (as node_modules/@angular/cli/node_modules for example) webpack isn't seeing them.
Currently vendor Angular libraries will have their *.ngfactory.ts in main.ts when building with `--aot`.
The easiest way to see this is with `source-map-explorer.
This PR correctly puts them in vendor.ts.
This PR uses a new Karma plugin to enable vendor bundles in unit tests,
increasing rebuild performance.
On a medium size project rebuilds times were 15x smaller (16.5s to 0.9s).
Fix#5423
I tried to implement a continuous integration system on my VPS. I have a PHP script that runs ng build. However in my default PHP configuration no environment variable HOME or USERPROFILE was set. I had this error : `Path must be a string. Received undefined`.
I had to take some time to see where the problem came from so I made a pull request to clarify the error.
Now it is : `Error: Missing environment variable HOME` which does not require to look at the code. This message would have saved me some time.
Also fixes any encountered errors.
This only changes the version used for the CLI's development. The project template version of tslint cannot be updated until codelyzer supports the latest version. ([codelyzer tracking issue](https://github.com/mgechev/codelyzer/issues/281))
Blocked by #5500 (fix is included in this PR so that CI will run).
Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.
This in turn was hiding errors related to typeRoots lookups.
It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.
This might also have contributed to the overall slowness of unit tests in #5423.
Related to TypeStrong/ts-node#283Fix#3911Fix#5332Fix#5351