121 Commits

Author SHA1 Message Date
Filipe Silva
28e66f352d fix(@angular/cli): improve rebundling speed
Forcing TypeScript to output commonjs modules instead of es2015 modules drastically improves rebuild speeds, especially for AOT.

This PR forces this option on the following modes:
- `ng build --watch --target=development`
- `ng serve --target=development`
- `ng test --code-coverage=false`

Please note that `--target=development` and `--code-coverage=false` are the defaults.

See https://github.com/webpack/webpack/issues/5863 for the webpack issue.
2017-10-20 11:00:51 -07:00
Filipe Silva
d8fcb122e9 fix(@angular/cli): support rxjs 5.5 path alias
Blocked by an answer to https://github.com/ReactiveX/rxjs/issues/2979.

Fix #8096
2017-10-19 14:59:12 -07:00
Filipe Silva
7f6a2f8450 fix(@angular/cli): don't drop resource extentions
Fix #8099
2017-10-19 14:50:26 -07:00
Filipe Silva
62c858c39a fix(@angular/cli): update file-loader and url-loader
This should fix errors like the one below for 0.6.0:
```
URL Loader Invalid Options

options['name'] should NOT have additional properties
options.limit should be number
```
2017-10-18 12:26:05 -07:00
Filipe Silva
451f17cc04 fix(@angular/cli): strip decorators with Angular 5+ (#8077)
We feel build `--build-optimizer` is stable enough to not be experimental anymore.

This PR defaults `build-optimizer`  when using Angular 5+ on a production build with `--aot`.

It can still be turned off with `--no-build-optimizer` (or `--build-optimizer=false`).

Fix #8050
2017-10-18 19:49:49 +01:00
Filipe Silva
a8c8ac8edb fix(@angular/cli): add missing webpack-sources dep
`license-webpack-plugin` has a peer dependency on `webpack-sources` that was being satisfied via hoisting.

Fix #8075
2017-10-18 19:01:56 +01:00
Filipe Silva
a9d2b9a172 fix(@ngtools/webpack): rebuild only changed ngfactories
This should improve AOT compilation times.
2017-10-15 03:09:21 +01:00
Filipe Silva
d55740d4fa fix(@angular/cli): support existing tsconfig.spec.json on Angular 5 2017-10-05 13:16:07 -04:00
Filipe Silva
08b284ec62 feat(@angular/cli): use eval-source-map for serve on dev targets 2017-10-05 13:15:30 -04:00
Hans Larsen
aa02086d02 feat(@angular/cli): add a bundle dependencies flag
This flag allows people who know what theyre doing to bundle the
server build together with all dependencies. It should only be
used when the whole rendering process is part of the main.ts
or one of its dependencies.

Fixes #7903.
2017-10-05 09:56:11 -07:00
Filipe Silva
d430abe9e3 feat(@angular/cli): always use new compiler with Angular 5 2017-10-02 12:52:02 -04:00
Filipe Silva
335bd04be4 feat(@angular/cli): support xi18n with Angular 5 2017-09-28 21:12:31 +01:00
Filipe Silva
ecb91bed8f feat(@ngtools/webpack): add JIT support to AngularCompilerPlugin 2017-09-28 21:12:31 +01:00
Charles Lyding
8f73714a3a feat(@angular/cli): support subresource integrity validation 2017-09-26 16:27:30 +01:00
Filipe Silva
42d59d5e3b feat(@angular/cli): propagate --preserve-symlinks on TS options
With TypeScript 2.5 supporting the `--preserve-symlinks` option, we should set it on the compiler options when the flag is passed into the CLI (it already works for webpack).

See https://blogs.msdn.microsoft.com/typescript/2017/08/31/announcing-typescript-2-5/#user-content-the---preservesymlinks-compiler-flag for more info.
2017-09-25 18:01:55 +01:00
Garo Yeriazarian
29ec3c0658 feat(@angular/cli): add fallback for CSS variables (#7770)
Aim to resolve #7514 by including postcss-custom-properties. This will generate extra rules in CSS when a `var()` is used to allow for compatibility with older IE browsers that do not support the feature.
2017-09-25 12:10:09 +01:00
Charles Lyding
206064a399 fix(@angular/cli): ensure asset output is within the output path 2017-09-25 11:43:09 +01:00
Charles Lyding
8ebc37a1fd fix(@angular/cli): support app option for test command 2017-09-25 10:40:38 +01:00
Charles Lyding
546ac49d93 fix(@angular/cli): only set less-loader paths when present in config 2017-09-20 10:06:25 -04:00
Filipe Silva
939cd6c02d feat(@ngtools/webpack): add AngularCompilerPlugin 2017-09-13 16:21:16 -07:00
Filipe Silva
dea04b1d57 feat(@angular/cli): support ES2015 target 2017-09-13 12:26:00 -07:00
Filipe Silva
38a7ab47c6 fix(@angular/cli): fix asset watching
https://github.com/kevlened/copy-webpack-plugin is now used instead of the custom plugin, it has since implemented the features we needed.

Fix #7521
2017-09-05 21:45:19 +01:00
Dmitriy Shekhovtsov
0111f18b36 fix(@angular/cli): fix test coverage when testing linked libs (#7447) 2017-08-20 11:43:03 -07:00
Olivier Combe
e746369ca4 feat(@angular/cli): add AOT parameter missingTranslation
This adds the new parameter `missingTranslation` for AoT that was added in angular/angular/pull/15987 and that lets you define the MissingTranslationStrategy
2017-08-18 12:15:55 -07:00
Filipe Silva
e8f27f029a feat(@angular/cli): support sourcemaps and minification in scripts
Adds sourcemap and minification to javascript added via the `scripts` array in `.angular-cli.json`.

`script-loader` is no longer used, which should help with CSP since it used `eval`.

Scripts will no longer appear in the console output for `ng build`, as they are now assets instead of webpack entry points.

It's no longer possible to have the `output` property of both a `scripts` and a `styles` entry pointing to the same file. This wasn't officially supported or listed in the docs, but used to be possible.

Fix #2796
Fix #7226
Fix #7290

Related to #6872
2017-08-17 16:38:35 -04:00
Filipe Silva
505d69a13c feat(@angular/cli): update license-webpack-plugin
See https://github.com/xz64/license-webpack-plugin/issues/14, https://github.com/xz64/license-webpack-plugin/issues/13.

Fix #7203
2017-08-17 13:43:51 -04:00
Mike Brocchi
99eba9823c fix(@angular/cli): Revert change to config reading
The code before this change prevented reading of global configuration values.
2017-08-10 10:40:22 -07:00
Robin Dijkhof
b7b42ab95a fix(@angular/cli): prevent unicode character compression 2017-08-04 11:18:13 -07:00
JPeer264
260c781642 feat(@angular/cli): support includePaths for less (closes #7083) 2017-08-02 11:53:13 +01:00
Charles Lyding
e486d17798 refactor(@angular/cli): update TS type dependencies 2017-08-01 09:09:15 +01:00
Filipe Silva
5a84026a49 fix(@angular/cli): use 3 uglify passes with build-optimizer
PURE comments work best with 3 passes.
See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926 for context and an example.

Thanks to @kzc for highlighting this.
2017-07-31 20:10:27 +01:00
Charles Lyding
0888e82422 fix(@angular/cli): standardize output path behavior 2017-07-31 13:58:48 +01:00
Charles Lyding
a329014ddb fix(@angular/cli): prevent .cur file inlining
IE does not support data URI cursors.
2017-07-26 21:11:17 +01:00
Charles Lyding
bf55bfd044 fix(@angular/cli): remove deprecated json-loader 2017-07-26 21:10:57 +01:00
Filipe Silva
7b9fc285e3 feat(@angular/cli): support TypeScript 2.4
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
2017-07-21 15:55:43 -04:00
FrozenPandaz
6f23636323 feat(@angular/cli): add ability to build bundle for node and export lazy route map 2017-07-20 15:01:25 -07:00
Filipe Silva
826c634090 feat(@angular/cli): add flag to control chunk naming
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.
2017-07-19 13:53:07 -04:00
Filipe Silva
9ec5b4ed66 feat(@angular/cli): add build-optimizer support
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.
2017-07-19 12:27:23 -04:00
Kevin Phelps
26e94339ba feat(@angular/cli): make the common chunk optional
- Add a "--no-common-chunk" build option for disabling the common async chunk.
- The existing behavior is maintained by default.

closes #7021
2017-07-19 10:13:24 -04:00
Mike Brocchi
f735760a34 fix(@angular/cli): Prevent re-reading config file if project & global are the same
Addresses #4207
2017-07-14 14:03:40 -07:00
Filipe Silva
fe85750cb7 feat(@angular/cli): add scope hoisting via webpack 3
This should result in significant bundle size reduction. For best results, build for production with `--vendor-chunk=false`.

See https://medium.com/webpack/webpack-3-official-release-15fd2dd8f07b for details.
2017-07-10 16:59:08 -07:00
Filipe Silva
7f280499cd feat(@angular/cli): add build defaults to config
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.
2017-07-06 15:03:19 -07:00
Filipe Silva
2780c3d7ab fix(@angular/cli): use inline sourcemaps in test
Fix #6737
2017-07-05 18:47:51 -07:00
Filipe Silva
5a0e80ffd3 feat(@angular/cli): name lazy chunks
Before:
```
$ ng build --no-progress
Hash: ff03df269349b817eef4
Time: 11202ms
chunk    {0} 0.chunk.js, 0.chunk.js.map 1.61 kB {1} {3} [rendered]
chunk    {1} 1.chunk.js, 1.chunk.js.map 1.46 kB {0} {3} [rendered]
chunk    {2} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 160 kB {6} [initial] [rendered]
chunk    {3} main.bundle.js, main.bundle.js.map (main) 6.38 kB {5} [initial] [rendered]
chunk    {4} styles.bundle.js, styles.bundle.js.map (styles) 10.5 kB {6} [initial] [rendered]
chunk    {5} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.16 MB [initial] [rendered]
chunk    {6} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
```

After:
```
$ ng build --no-progress
Hash: 2bc12a89f40f3b4818b5
Time: 9613ms
chunk {feature.module} feature.module.chunk.js, feature.module.chunk.js.map 1.46 kB {lazy.module} {main} [rendered]
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
chunk {lazy.module} lazy.module.chunk.js, lazy.module.chunk.js.map 1.61 kB {feature.module} {main} [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 6.38 kB {vendor} [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 160 kB {inline} [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 10.5 kB {inline} [initial] [rendered]
chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.16 MB [initial] [rendered]
```

Fix #6700
2017-07-05 14:50:52 -07:00
Filipe Silva
28e4114785 feat(@angular/cli): followup changes to circular dependency detection
Flag is now positive instead of negative and shorter, and can now be set on commands as well (`--show-circular-dependencies`).

Dependency was also added to eject as per https://github.com/angular/angular-cli/pull/6813#issuecomment-311567074.
2017-06-29 11:18:39 -07:00
Filipe Silva
1f3738b19f feat(@angular/cli): add circular dependency detection
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
2017-06-27 16:30:30 +01:00
Charles Lyding
143a0748b5 refactor(@angular/cli): cleanup global config path discovery 2017-06-27 14:35:34 +01:00
Alex Rickabaugh
220e59dbf4 fix(@angular/cli): check for existing SW manifest should look in project dir
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.
2017-06-21 14:05:40 -07:00
Charles Lyding
bd0dac11aa fix(@angular/cli): correct sourcemap source paths 2017-06-15 13:50:35 -04:00
Charles Lyding
10ec556813 fix(@angular/cli): provide file path with config parse errors 2017-06-15 13:29:01 -04:00