1903 Commits

Author SHA1 Message Date
Alan Agius
0a74d0d28d fix(@angular-devkit/build-angular): change several builder options defaults
BREAKING CHANGE:

A number of browser and server builder options have had their default values changed. The aim of these changes is to reduce the configuration complexity and support the new "production builds by default" initiative.

**Browser builder**
| Option                                 | Previous default value    | New default value |
|----------------------------------------|---------------------------|-------------------|
| optimization                           | false                     | true              |
| aot                                    | false                     | true              |
| buildOptimizer                         | false                     | true              |
| sourceMap                              | true                      | false             |
| extractLicenses                        | false                     | true              |
| namedChunks                            | true                      | false             |
| vendorChunk                            | true                      | false             |

**Server builder**
| Option        | Previous default value | New default value |
|---------------|------------------------|-------------------|
| optimization  | false                  | true              |
| sourceMap     | true                   | false             |
2021-04-21 12:39:01 -07:00
Alan Agius
a8ff9d408b test(@angular-devkit/build-angular): add debounceTime to stabilize FS 2021-04-21 12:38:17 -07:00
Charles Lyding
85ce5ec3b0 fix(@angular-devkit/build-angular): always inject live reload client when using live reload
The current stable version of `webpack-dev-server` does not fully handle Webpack 5's configuration options. In this case, the `target` option can now be an array. However, the array form is ignored by the dev server which can cause the live reload client code to not be included in the output bundles. To remedy this, the `injectClient` option is used when live reload is enabled which forces the client code to be included regardless of the `target` option.
2021-04-21 12:34:56 -07:00
Charles Lyding
ef6996aeff perf(@angular-devkit/build-angular): use Webpack's GC memory caching in watch mode
The GC caching mode will remove any unused cache entries after each rebuild. This prevents old modules from being retained indefinitely during long-lived development sessions.
2021-04-21 12:34:10 -07:00
Renovate Bot
a6cc86786b build: update core-js to version 3.10.2 2021-04-20 09:31:37 -05:00
Renovate Bot
4eb9151510 build: update css-loader to version 5.2.4 2021-04-20 09:31:12 -05:00
Charles Lyding
e107055b6f fix(@angular-devkit/build-angular): disable Webpack 5 automatic public path support
The Webpack 5 automatic public path support can cause an incorrect public path to be used to load assets and lazy loaded routes. The current logic relies on the last script element found at runtime in the application's index HTML which may not be related to the application scripts. Now if a `deployUrl` is not specified, the Webpack `publicPath` option is defaulted to an empty string which provides equivalent behavior to Webpack 4.
2021-04-20 09:29:49 -05:00
Alan Agius
7d56d480c1 fix(@angular-devkit/build-angular): recover from CSS optimization errors 2021-04-20 09:29:12 -05:00
Alan Agius
04f5dfe5e2 fix(@angular-devkit/build-angular): use new Webpack watch API in karma webpack plugin
In Webpack 5, the Webpack callback must be used when Webpack is running in watch mode.

Related warning
```
.(node:6565) [DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] DeprecationWarning: A 'callback' argument need to be provided to the 'webpack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.
```
2021-04-20 09:27:05 -05:00
Alan Agius
cb9e51f687 refactor(@angular-devkit/build-angular): remove custom Webpack Stats types
Webpack 5 contains improved types that we can leverage.
2021-04-20 09:27:05 -05:00
Renovate Bot
1c6ba1f9f6 build: update open to version 8.0.6 2021-04-19 20:33:19 +02:00
Renovate Bot
072f3a7009 build: update webpack to version 5.34.0 2021-04-19 20:33:01 +02:00
Renovate Bot
6d0207d4a2 build: update less-loader to version 8.1.1 2021-04-19 20:32:40 +02:00
Renovate Bot
fd655d463f build: update sass to version 1.32.10 2021-04-19 20:32:27 +02:00
Charles Lyding
5804fec902 refactor(@angular-devkit/build-angular): remove Webpack 4 specific type casting
Webpack 5 contains improved types and exports that reduce the need to perform additional type casting throughout the internal Webpack plugins.
2021-04-19 20:32:13 +02:00
Charles Lyding
e0cb8222ea fix(@angular-devkit/build-angular): replace Webpack 4 hashForChunk hook usage
Webpack 5 now uses a `chunkHash` hook that is accessible from `JavascriptModulesPlugin.getCompilationHooks()`. The `hashForChunk` hooks have been deprecated in Webpack 5.
2021-04-19 20:31:59 +02:00
Charles Lyding
e55923656c fix(@angular-devkit/build-angular): avoid double build optimizer processing
TypeScript files had the potential to be processed twice by the build optimizer. This did not affect the output code but could lead to longer production build times. The build optimizer is now configured in one centralized location for both TypeScript and JavaScript files. The Webpack configuration partial for TypeScript support is also reduced to one common function for both AOT and JIT as a result.
2021-04-19 20:30:21 +02:00
Renovate Bot
71717cf406 build: update mini-css-extract-plugin to version 1.5.0 2021-04-19 20:30:05 +02:00
Alan Agius
b8875397ce docs(@angular-devkit/build-angular): add readme file 2021-04-19 09:39:59 -05:00
Alan Agius
d7bedb7293 build: promote @angular-devkit/build-angular to stable 2021-04-14 15:50:27 -04:00
Charles Lyding
27e63e2b33 fix(@angular-devkit/build-angular): mark programmatic builder execution functions as experimental
While the builders when executed via the Angular CLI and their associated options are considered stable, the programmatic APIs are not considered officially supported and are not subject to the breaking change guarantees of SemVer.
The programmatic APIs for the builders are now explicitly marked as experimental. This allows the package to use a stable versioning scheme while also continuing to provide access to the experimental programmatic API elements of the package.
2021-04-14 14:32:37 -04:00
Charles Lyding
d3bc530c10 refactor(@angular-devkit/build-angular): use Node.js promise fs API in service-worker augmentation
With the minimum version of Node.js now set to v12, the promise fs API can now be leveraged within the tooling.
This change also uses `copyFile` (with copy-on-write where available) to setup the the service worker files as well a streaming APIs to generate service worker hashes. Both of which improves performance and reduces memory usage.
2021-04-14 10:17:21 -04:00
Renovate Bot
8dbc5e7ee0 build: update cssnano to version 5.0.1 2021-04-14 07:22:20 -04:00
Charles Lyding
bac563e5ee feat(@angular-devkit/build-angular): support specifying stylesheet language for inline component styles
A new build option named `inlineStyleLanguage` has been introduced that will allow a project to define the stylesheet language used in an application's inline component styles. Inline component styles are styles defined via the `styles` property within the Angular `Component` decorator. Both JIT and AOT mode are supported. However, JIT mode requires that inline styles only be string literals (compile-time partial evaluation is not supported in JIT mode). Currently supported language options are: `CSS` (default), `Sass`, `SCSS`, and `Less`. If the option is not specified, `CSS` will be used and enables existing projects to continue to function as expected.
2021-04-14 07:21:11 -04:00
Charles Lyding
330235230c refactor(@angular-devkit/build-angular): remove redundant webpack-sources dependency
The `webpack` package now exports the `Source` based classes directly.
2021-04-13 15:34:54 -04:00
Alan Agius
076ab0f11f refactor: add correct schema keys
With this change
- We replace `id` with `$id`,  this no longer valid in draft-07.
- Replace all `$schemas` to `http://json-schema.org/draft-07/schema`, this is needed to "pin" the schema to `draft-07`.

More information about `draft-07` can be found https://json-schema.org/draft-07/json-schema-release-notes.html
2021-04-13 10:51:12 -04:00
Alan Agius
c609e7104c build: update to cssnano to version 5.0.0
Closes #19106
2021-04-13 10:50:02 -04:00
Alan Agius
cc52e5453c fix(@angular-devkit/build-angular): remove duplicate application bundle generation complete message
In some scenarios in Webpack 5 percentage goes from 1 back to 0.99, ex: 0.99 -> 1 -> 0.99 -> 1. This causes the "complete" message to be displayed multiple times.
2021-04-13 10:49:40 -04:00
Alan Agius
1532e32cc2 refactor: clean up webpack 4 code 2021-04-13 10:49:17 -04:00
Renovate Bot
871f9eee77 build: update webpack to version 5.32.0 2021-04-13 10:43:33 -04:00
Charles Lyding
440f57943d build: update webpack to version 5.31.2 2021-04-12 14:08:43 -04:00
Charles Lyding
d47b4417d4 feat(@angular-devkit/build-angular): support processing component inline CSS styles
The internal Webpack configuration now includes support for style rules with MIME type conditions. This allows the data URIs generated for inline component CSS styles by the Angular Webpack plugin to be processed with the same loaders as file based styles.
2021-04-12 14:08:43 -04:00
Alan Agius
dee6b79489 refactor: remove @types/webpack 2021-04-12 10:02:07 -04:00
Alan Agius
0f4bbb58d4 refactor(@angular-devkit/build-angular): remove webpack 4 checks
These are no longer needed as we don't support Webpack 4 any longer
2021-04-12 10:02:07 -04:00
Alan Agius
bd0aba7c80 fix(@angular-devkit/build-angular): disable webpack cache when using NG_BUILD_CACHE 2021-04-12 10:02:07 -04:00
Alan Agius
ab9e5dd138 build: update @types/karma to ^6.3.0 2021-04-12 06:24:54 -04:00
Renovate Bot
23d6ba07fb build: update postcss to version 8.2.10 2021-04-11 17:23:09 -04:00
Renovate Bot
c47da9ad47 build: update license-webpack-plugin to version 2.3.17 2021-04-11 08:35:14 -04:00
Renovate Bot
92a93280f8 build: update less-loader to version 8.1.0 2021-04-10 12:09:28 -04:00
Renovate Bot
47f09fab79 build: update css-loader to version 5.2.1 2021-04-10 12:09:19 -04:00
Alan Agius
695a01ba02 feat(@schematics/angular): configure new libraries to be published in Ivy partial mode
With this change we configure new libraries to be published using Ivy partial compilation instead of the deprecated View Engine rendering engine, we also remove several view engine specific `angularCompilerOptions`.

New libraries can be published using this format, as they are not depend upon by View Engine libraries or application.
2021-04-09 18:40:39 -04:00
Alan Agius
f145312666 fix(@angular-devkit/build-angular): update karma builder to use non-deprecated API
With this change we update the Karma builder to use the new Server API.

Closes: #20479
2021-04-09 13:36:07 -04:00
Renovate Bot
934753c330 build: update postcss-loader to version 5.2.0 2021-04-09 07:14:20 -04:00
Renovate Bot
6953391afb build: update css-loader to version 5.2.0 2021-04-09 07:13:36 -04:00
Charles Lyding
79f369c26f refactor(@angular-devkit/build-angular): optimize analytics plugin bundle stats for Webpack 5
Newer Webpack 5 APIs allow the bundle stat generation for analytics to be optimized including less iteration of chunks and assets.
2021-04-08 09:42:47 -04:00
Charles Lyding
43e22ae24a build: update webpack to version 5.30.0 2021-04-08 09:42:47 -04:00
Charles Lyding
d883ce5d7e feat(@angular-devkit/build-angular): upgrade to Webpack 5 throughout the build system
With this change Webpack 5 is now used by the Angular tooling to build applications. Webpack 4 usage and support has been removed.
No project level configuration changes are required to take advantage of the upgraded Webpack version when using the official Angular builders.
Custom builders based on this package that use the experimental programmatic APIs may need to be updated to become compatible with Webpack 5.

BREAKING CHANGE: Webpack 5 lazy loaded file name changes
Webpack 5 generates similar but differently named files for lazy loaded JavaScript files in development configurations (when the `namedChunks` option is enabled).
For the majority of users this change should have no effect on the application and/or build process. Production builds should also not be affected as the `namedChunks` option is disabled by default in production configurations.
However, if a project's post-build process makes assumptions as to the file names then adjustments may need to be made to account for the new naming paradigm.
Such post-build processes could include custom file transformations after the build, integration into service-side frameworks, or deployment procedures.
Example development file name change: `lazy-lazy-module.js` --> `src_app_lazy_lazy_module_ts.js`

BREAKING CHANGE: Webpack 5 web worker support
Webpack 5 now includes web worker support. However, the structure of the URL within the `Worker` constructor must be in a specific format that differs from the current requirement.
Web worker usage should be updated as shown below (where `./app.worker` should be replaced with the actual worker name):
Before: `new Worker('./app.worker', ...)`
After:  `new Worker(new URL('./app.worker', import.meta.url), ...)`
2021-04-08 09:42:47 -04:00
Renovate Bot
b7c77f6a86 build: update core-js to version 3.10.1 2021-04-08 08:35:10 -04:00
Renovate Bot
6ae3f8de49 build: update mini-css-extract-plugin to version 1.4.1 2021-04-08 08:31:57 -04:00
Charles Lyding
e607d4482e test(@angular-devkit/build-angular): increase bazel shards for dev-server tests
With recent improvements to the dev-server builder unit tests, additional parallel testing should now be possible.
The unused `express` dependencies are also removed.
2021-04-07 19:16:07 -04:00