138 Commits

Author SHA1 Message Date
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
Charles Lyding
f75b5a7151 feat(@angular/cli): improve common bundling performance 2017-06-12 09:48:49 -04:00
laco0416
692b378770 feat(@angular/cli): add baseHref property to appConfig 2017-06-12 09:44:44 -04:00
Tatsuyuki Ishi
75311c2a45 feat(@angular/cli): add support for minifying HTML
Close #1861
2017-06-07 18:49:09 +01:00
Gleb Gusachenko
407625ca90 feat(@angular/cli): support loading webp images (#6594)
Fix #6526
2017-06-07 18:42:34 +01:00
Sumit Arora
0e153cb765 fix(@angular/cli): fix env path 2017-06-06 15:04:38 +01:00
Sumit Arora
e72693a948 feat(@angular/cli): remove deduped licenses 2017-06-02 19:19:44 +01:00
Charles Lyding
af3e6b22f4 feat(@angular/cli): add option to preserve symlinks for module resolution 2017-06-01 11:47:19 +01:00
Douglas Duteil
be7a7162eb fix(@angular/cli): resolve in all available node_modules
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.
2017-05-31 13:07:03 -07:00
Hans Larsen
9c7a7ea47b fix(@angular/cli): allow node_modules to be linked somewhere else.
Fixes #6499.
2017-05-31 10:59:22 -07:00
Filipe Silva
b9f8ca648d fix(@angular/cli): put vendor ngfactory in vendor chunk
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.
2017-05-17 16:16:28 -07:00
clydin
e0a454ffc2 fix(@angular/cli): enable full node module resolution for project deps (#6276) 2017-05-15 17:46:05 -04:00
Preston Van Loon
a5d8bc1706 fix(@angular/cli): ng get: return whole config root when no path provided.
Close #5887
2017-05-09 07:17:22 -07:00
Filipe Silva
1cd0a0811d feat(@angular/cli): improve ng test performance
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
2017-05-08 16:51:40 +01:00
Filipe Silva
8bf040b7e3 feat(@angular/cli): add flag to not delete output path
Fix #5925
Fix #6193
2017-05-08 14:27:59 +01:00
Tatsuyuki Ishi
3d9a7ff24d refactor(@angular/cli): use EnvironmentPlugin instead of DefinePlugin 2017-05-08 12:18:29 +01:00
Victor Boissiere
11d0afc98a fix(@angular/cli): add error message when missing config env variable (#5980)
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.
2017-05-04 20:23:43 +01:00
clydin
de8336d90a test: update development tslint version (#5936)
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))
2017-05-04 20:13:13 +01:00
Charles Lyding
67646796d9 refactor(@angular/cli): only setup CSS extraction if actually extracting 2017-05-04 19:54:47 +01:00
Charles Lyding
b07f631773 feat(@angular/cli): always use named webpack modules in dev builds 2017-05-04 19:52:48 +01:00
Charles Lyding
806447e611 fix(@angular/cli): use safer stylesheet minification settings 2017-05-03 12:48:32 -07:00
Charles Lyding
f82da18f8b fix(@angular/cli): set sass precision to bootstrap required value 2017-04-11 16:36:10 -07:00
Charles Lyding
4563ec583a refactor(@angular/cli): modernize webpack style config
Close #5672
2017-03-29 11:04:09 +01:00
Charles Lyding
36b8c9bd02 fix(@angular/cli): allow the use of a base-href with scheme 2017-03-23 17:28:44 -07:00
Sumit Arora
1fe921da93 fix(@angular/cli): Fixing global path issue 2017-03-23 08:47:15 -07:00
Filipe Silva
9cda847035 fix(@angular/cli): fix error handling on test
Fix #2778
Fix #3424
2017-03-20 09:10:17 -07:00
Filipe Silva
303b2c035a fix(@angular/cli): fix test typings
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#283

Fix #3911
Fix #5332
Fix #5351
2017-03-20 09:10:17 -07:00
Hans Larsen
d94040b2de fix(@angular/cli): sourcemaps should be the main option, sourcemap an alias 2017-03-14 15:32:00 -07:00
Filipe Silva
501e974384 fix(@angular/cli): don't break deployUrl with scheme
Fix #5254
2017-03-13 16:19:37 -07:00
Charles Lyding
1e7d519d04 fix(@angular/cli): only adjust root relative stylesheet urls
Close #5238
2017-03-09 10:46:30 +00:00
Alex Rickabaugh
f3644a939c fix(@angular/cli): pass the base href through to the sw plugin 2017-03-02 13:49:18 -08:00
Alex Rickabaugh
7f03b5a31e fix(@angular/cli): look for existing manifest in src/ as well 2017-03-02 13:49:18 -08:00
Olivier Combe
d52d290c80 feat(@angular/cli): add new xi18n parameters --locale and --outFile (#5154)
Fixes #5145
2017-03-02 11:54:01 -08:00
Mike Brocchi
1609554c4d refactor(@angular/cli): consolidate config reading logic (#5023) 2017-02-27 21:22:19 -08:00