383 Commits

Author SHA1 Message Date
Alan Agius
f86b384df4 fix(@angular-devkit/build-angular): handle service-worker serving with localize in dev-server
Previously, we tried to read the files from the wrong location as during localize we alter the output directory to a different temporary location.

7e64b1537d/packages/angular_devkit/build_angular/src/utils/i18n-options.ts (L251-L252)

Closes #23844
2022-09-02 12:25:20 -04:00
Alan Agius
9aab9ad54d fix(@angular-devkit/build-angular): issue warning when using deprecated tilde imports
With this change we add a warning when using deprecated tilde/`~` imports.
2022-08-30 12:26:14 -04:00
Alan Agius
147f8c3ebb fix(@angular-devkit/build-angular): correctly handle parenthesis in url
PR #23691 introduced a regression that caused paranthesis in url not to be handled correctly.

This change correct this behaviour and adds a test case to valid this.

Closes #23773
2022-08-22 16:01:14 -07:00
Alan Agius
4368c85983 refactor: remove unused local variables 2022-08-12 08:19:26 -04:00
Alan Agius
78cacc30e5 refactor(@angular-devkit/build-angular): remove workaround for handle options requests
The upstream fix https://github.com/webpack/webpack-dev-server/issues/4180 has been merged and released as part of `webpack-dev-server` version `4.10.0`
2022-08-11 09:40:42 -04:00
Alan Agius
7de9b470cb fix(@angular-devkit/build-angular): avoid collect stats from chunks with no files
This commit updates to bundle stats logic to skip checking chunks with no files.

Closes #23717
2022-08-10 09:55:19 -04:00
Alan Agius
44c25511ea feat(@angular-devkit/build-angular): add ability to serve service worker when using dev-server
With this change we add the ability for the dev-server to serve service workers when configured in the browser builder.

Closes #9869
2022-08-04 11:26:30 -07:00
Alan Agius
70bc35456a fix(@angular-devkit/build-angular): correctly handle data URIs with escaped quotes in stylesheets
Previously, the RegExp didn't correctly handle cases where data URIs had escaped quotes like the below

```css
url("data:image/svg+xml;charset=utf-8,<svg width=/"16/" height=/"15/"></svg>")
```

Closes #23680
2022-08-04 11:25:25 -07:00
Angular Robot
afdb266ad1 build: update all non-major dependencies 2022-08-03 10:34:50 -07:00
Alan Agius
b4a1b0f104 fix(@angular-devkit/build-angular): correctly respond to preflight requests
With this commit, we add a middleware that handles preflight requests as currently responses for this type of requests returning 404.

This is a temporary workaround until this issue is fixed upstream. See: https://github.com/webpack/webpack-dev-server/issues/4180

Closes #23639
2022-08-02 09:47:52 -07:00
Charles Lyding
6a142a22f8 fix(@angular-devkit/build-angular): allow the esbuild-based builder to fully resolve global stylesheet packages
The esbuild-based experimental builder will now leverage the bundler to perform resolution of CSS imports.
This allows for more comprehensive resolution including packages which use the `sass` and/or `style` custom
conditions within a `package.json` exports field.
2022-07-22 10:45:31 -04:00
Victor Porof
f3087dc434 feat(@angular-devkit/build-angular): Identify third-party sources in sourcemaps
This PR includes a webpack plugin which adds a field to source maps that identifies which sources are vendored or runtime-injected (aka third-party) sources. These will be consumed by Chrome DevTools to automatically ignore-list sources.

When vendor source map processing is enabled, this is interpreted as the developer intending to debug third-party code; in this case, the feature is disabled.

Signed-off-by: Victor Porof <victorporof@chromium.org>
2022-07-18 15:33:33 -04:00
Alan Agius
d8cfe8b226 fix(@angular-devkit/build-angular): fallback to use projectRoot when sourceRoot is missing during coverage
With this change we fallback to use the projectRoot when the sourceRoot is missing for files to be included in coverage.

Closes: #23591
2022-07-18 12:25:59 -04:00
martinfrancois
357c45e484 fix(@angular-devkit/build-angular): generate different content hashes for scripts which are changed during the optimization phase
Instead of generating the content hash based on the content of scripts BEFORE the optimization phase,
the content hash is generated AFTER the optimization phase.

Prevents caching issues where browsers block execution of scripts due to the integrity hash not matching
with the cached script in case of a script being optimized differently than in a previous build,
where it would previously result in the same content hash.

Fixes #22906
2022-07-12 10:19:58 -07:00
Alan Agius
d2bbcd7b68 fix(@angular-devkit/build-angular): improve detection of CommonJS dependencies
With this change we include `CommonJsSelfReferenceDependency` and `CommonJsExportsDependency` in the CJS checks.

Closes #23505
2022-07-06 16:33:21 +02:00
Alan Agius
7a24609143 fix(@angular-devkit/build-angular): disable glob mounting for patterns that start with a forward slash
By default, a glob pattern starting with a forward slash will be "mounted" onto the system root. This causes globs to escape the workspace root.

With this change we configure disable glob "mounting" and also change the root to the same setting of the `cwd`.

Closes #23467
2022-06-30 08:41:12 -04:00
Alan Agius
3153f7c496 ci: remove flakey test behaviour
During testing architect isn't spawned as a new process therefore we the global state can be tained from previous runs.

`es5TargetWarningsShown` which was saved in the global state caused flakiness.
2022-06-28 09:43:08 -04:00
Alan Agius
b40aeed441 fix(@angular-devkit/build-angular): hide stacktraces from webpack errors
In many cases Webpack will output errors with stacktraces even when `errorStack` is configured to false which bloats the terminal and makes the actual error harder to find.

With this change we output stacktraces only when using the `verbose` option.

Before
```
$ ng build

./src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[5].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[5].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[5].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[5].rules[1].use[1]!./src/styles.scss - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
1 │ @import "invalid";
  │         ^^^^^^^^^
  ╵
  src/styles.scss 1:9  root stylesheet

./src/styles.scss - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
HookWebpackError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
1 │ @import "invalid";
  │         ^^^^^^^^^
  ╵
  src/styles.scss 1:9  root stylesheet
    at tryRunOrWebpackError (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/HookWebpackError.js:88:9)
    at __webpack_require_module__ (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/Compilation.js:5051:12)
    at __webpack_require__ (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/Compilation.js:5008:18)
    at /usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/Compilation.js:5079:20
    at symbolIterator (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/neo-async/async.js:3485:9)
    at done (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/neo-async/async.js:3527:9)
    at Hook.eval [as callAsync] (eval at create (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/tapable/lib/Hook.js:18:14)
    at /usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/Compilation.js:4986:43
    at symbolIterator (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/neo-async/async.js:3482:9)
-- inner error --
Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
1 │ @import "invalid";
  │         ^^^^^^^^^
  ╵
  src/styles.scss 1:9  root stylesheet
    at Object.<anonymous> (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[5].rules[0].oneOf[0].use[1]!/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[5].rules[0].oneOf[0].use[2]!/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/resolve-url-loader/index.js??ruleSet[1].rules[5].rules[1].use[0]!/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[5].rules[1].use[1]!/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/src/styles.scss:1:7)
    at /usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/javascript/JavascriptModulesPlugin.js:441:11
    at Hook.eval [as call] (eval at create (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
    at Hook.CALL_DELEGATE [as _call] (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/tapable/lib/Hook.js:14:14)
    at /usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/Compilation.js:5053:39
    at tryRunOrWebpackError (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/HookWebpackError.js:83:7)
    at __webpack_require_module__ (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/Compilation.js:5051:12)
    at __webpack_require__ (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/Compilation.js:5008:18)
    at /usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/webpack/lib/Compilation.js:5079:20
    at symbolIterator (/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/neo-async/async.js:3485:9)

Generated code for /usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[5].rules[0].oneOf[0].use[1]!/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[5].rules[0].oneOf[0].use[2]!/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/resolve-url-loader/index.js??ruleSet[1].rules[5].rules[1].use[0]!/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[5].rules[1].use[1]!/usr/local/xxxxxxx/cli-reproductions/showwcase-v14-rc0/src/styles.scss
1 | throw new Error("Module build failed (from ./node_modules/sass-loader/dist/cjs.js):\nSassError: Can't find stylesheet to import.\n  ╷\n1 │ @import \"invalid\";\n  │         ^^^^^^^^^\n  ╵\n  src/styles.scss 1:9  root stylesheet");
```

After
```
$ ng build

./src/styles.scss - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
1 │ @import "invalid";
  │         ^^^^^^^^^
  ╵
  src/styles.scss 1:9  root stylesheet

./src/styles.scss - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
HookWebpackError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
1 │ @import "invalid";
  │         ^^^^^^^^^
  ╵
  src/styles.scss 1:9  root stylesheet
```
2022-06-27 09:08:54 -04:00
Alan Agius
4fcfc37cb9 fix(@angular-devkit/build-angular): exit dev-server when CTRL+C is pressed
Since version 4, webpack-dev-server by default will shutdown gracefully. This results in `CTRL+C` needed to be pressed multiple times to exit the process.

See: c76b6d11a3/lib/Server.js (L1801-L1827)

Closes #22216
2022-06-27 09:08:30 -04:00
Alan Agius
0f02b0011b fix(@angular-devkit/build-angular): handle codeCoverageExclude correctly in Windows
Previously, `codeCoverageExclude` didn't work correct on Windows

Closes #23403
2022-06-21 11:26:59 -07:00
Charles Lyding
7431d1c256 refactor(@angular-devkit/build-angular): assert catch clause variable type before usage
Prepares the `@angular-devkit/build-angular` package for the eventual change of enabling the
TypeScript `useUnknownInCatchVariables` option. This option provides additional
code safety by ensuring that the catch clause variable is the proper type before
attempting to access its properties. Similar changes will be needed in the other
packages in the repository prior to enabling `useUnknownInCatchVariables`.
2022-06-14 11:28:21 +02:00
Alan Agius
f0a0b08457 fix(@angular-devkit/build-angular): log modified and removed files when using the verbose option
With this change we print out the modified and removed files when running a build in verbose mode. This can be useful to debug builds that rebuilds multiple times without an apparent file change.
2022-06-08 12:10:56 -04:00
Alan Agius
9301699f7a fix(@angular-devkit/build-angular): replace dev-server socket path from /ws to /ng-cli-ws
In some cases `/ws` caused conflicts with local websocket connections. Hence we change the dev-server web socket path to something more specific to the Angular CLI.

Closes #23260
2022-06-02 13:01:28 -07:00
Alan Agius
ee2e75610b fix(@angular-devkit/build-angular): detect tailwind.config.cjs as valid tailwindcss configuration
`tailwind.config.cjs` is a valid tailwindcss configuration file as it's listed in 8845d112fb/src/util/resolveConfigPath.js (L46-L52) as such we should also take this filename into consideration.

Closes #23236
2022-05-27 14:08:47 -04:00
Alan Agius
cd2250fe23 fix(@angular-devkit/build-angular): downlevel libraries based on the browserslist configurations
There is no standard for library authors to ship their library in different ES versions, which can result in vendor libraries to ship ES features which are not supported by one or more browsers that the user's application supports.

With this change, we will be downlevelling libraries based on the list of supported browsers which is configured in the browserslist configuration. Previously, we only downlevelled libraries when targeting ES5.

The TypeScript target option will not effect how the libraries get downlevelled.

Closes #23126
2022-05-24 10:02:17 -07:00
Alan Agius
6cbb9413d0 fix(@angular-devkit/build-angular): add debugging and timing information in JavaScript and CSS optimization plugins
This can be useful to debug slow builds.

Example of output
```
LOG from build-angular.JavaScriptOptimizerPlugin
<t> optimize asset: runtime.ad5c30339e926c89.js: 221.959564 ms
<t> optimize asset: polyfills.ec3ffae5bac27204.js: 1071.080092 ms
<t> optimize asset: main.aa8a15155ca2133f.js: 3391.588635 ms
<t> optimize js assets: 3483.799739 ms

LOG from build-angular.CssOptimizerPlugin
<t> optimize asset: styles.d251c5bf54715558.css: 26.569907 ms
<t> optimize css assets: 34.441737 ms
```

```
LOG from build-angular.JavaScriptOptimizerPlugin
<i> polyfills.ec3ffae5bac27204.js restored from cache.
<i> runtime.ad5c30339e926c89.js restored from cache.
<t> optimize asset: main.69fb55a243b46bfa.js: 2618.5191210000003 ms
<t> optimize js assets: 2721.226144 ms

LOG from build-angular.CssOptimizerPlugin
<i> styles.d251c5bf54715558.css restored from cache.
<t> optimize css assets: 12.149169 ms
```
2022-05-20 11:40:36 -07:00
Alan Agius
b71608195b fix(@angular-devkit/build-angular): close compiler on Karma exit
The webpack compiler was never closed which caused Webpack's shutdown hook c71832f3a9/packages/angular_devkit/build_angular/src/webpack/configs/styles.ts (L113-L114) to never be called and in turn caused the Sass workers never to be termined.
2022-05-18 12:46:05 -04:00
Charles Lyding
00186fb93f feat(@angular-devkit/build-angular): add initial experimental esbuild-based application browser builder
An experimental browser application builder (`browser-esbuild`) has been introduced that leverages esbuild as the bundler.
This new builder is compatible with options of the current browser application builder (`browser`) and can be enabled
for experimentation purposes by replacing the `builder` field of `@angular-devkit/build-angular:browser` from an existing
project to `@angular-devkit/build-angular:browser-esbuild`. The builder will generate an ESM-based application and
provides support for ES2015+ compatible output with ES2020 as the default.

This builder is considered experimental and is not recommended for production applications.

Currently not all `browser` builder options and capabilities are supported with this experimental builder.
Additional support for these options may be added in the future.
The following options and capabilities are not currently supported:
* Stylesheet Preprocessors (only CSS styles are supported)
* Angular JIT mode (only AOT is supported)
* Localization [`localize`]
* Watch and dev-server modes [`watch`, `poll`, etc.]
* File replacements [`fileReplacements`]
* License text extraction [`extractLicenses`]
* Bundle budgets [`budgets`]
* Global scripts [`scripts`]
* Build stats JSON output [`statsJson`]
* Deploy URL [`deployURL`]
* CommonJS module warnings (no warnings will be generated for CommonJS package usage)
* Web Workers
* Service workers [`serviceWorker`, `ngswConfigPath`]
2022-04-22 20:45:54 -04:00
Charles Lyding
1a160dac00 fix(@angular-devkit/build-angular): ensure karma sourcemap support on Windows
The `glob`-based check when adding the sourcemap support packages to the karma setup was incorrectly
skipping the files due to Windows pathing issues. The `glob`-based check, however, is unneeded due
to the already present `require.resolve` checks for the sourcemap support packages which will
throw if the packages are not present.
2022-04-16 07:42:20 +02:00
Alan Agius
be2b268c36 fix(@angular-devkit/build-angular): display debug logs when using the --verbose option
Webpack doesn't display debug logs when setting the log level to verbose.

See: https://webpack.js.org/configuration/other-options/#debug and https://webpack.js.org/configuration/other-options/#level
2022-04-11 11:47:09 -07:00
Charles Lyding
b8e9e09a51 refactor(@angular-devkit/build-angular): replace most custom path normalize usage with Node.js builtins
During the build initialization phase, many paths are converted back and forth between multiple normalized forms. These conversions involve potentially expensive string operations. The majority of the custom path `normalize` function from `@angular-devkit/core` usages have now been removed in favor of the Node.js builtin path functions. This change reduces the need to perform additional string manipulation where possible.
2022-03-31 17:00:58 -04:00
Alan Agius
371da23be0 fix(@angular-devkit/build-angular): add node_modules prefix to excludes RegExp
Without the `node_modules` prefix, projects named the same as the excluded package names ex: `webpack` will not compile successfully as all files under the mentioned project will be excluded from being requested by the respective loaders.

Closes #22902
2022-03-30 17:46:09 +02:00
Alan Agius
af8dd62b74 refactor(@angular-devkit/build-angular): remove esbuild-check workaround
This check is no longer needed as of `0.14.29` as now esbuild correctly propagates errors.

See: https://github.com/evanw/esbuild/blob/master/CHANGELOG.md#01429
2022-03-30 17:17:15 +02:00
Alan Agius
fac9cca66b fix(@angular-devkit/build-angular): don't override asset info when updating assets
Currently, we are overriding asset info instead of appending additional data to it.
2022-03-30 15:20:03 +02:00
Alan Agius
2ab77429bb fix(@angular-devkit/build-angular): allow Workers in Stackblitz
This is no longer needed as Stackblitz implemented the missing Node.Js worker APIs.
2022-03-29 13:35:13 +02:00
Alan Agius
455aeea12d fix(@angular-devkit/core): add Angular CLI major version as analytics dimension
With this change we replace the custom dimension 8 `AOT Enabled`, with `Angular CLI Major Version`. The motivation behind replacing this dimension is that the there is already an `aot` dimension with id 13 which serves for the same purpose.

More information to why we need a new dimension for the Angular CLI major version can be found #22130

Closes #22130
2022-03-24 08:53:10 +01:00
Charles Lyding
966d25b55e fix(@angular-devkit/build-angular): remove unneeded JIT reflect metadata polyfill
Since Angular 8, the CLI has transformed decorator metadata to a form that can be used by the Angular dependency injector without the TDZ limitations of Typescript's decorator metadata emit feature.
As a result, a JIT application compiled with the CLI no longer requires the reflect metadata polyfill that was provided by `core-js`.
This polyfill was also the last remaining usage of the `core-js` package within `@angular-devkit/build-angular` which allows the `core-js` package to also be removed.

Refs: https://github.com/angular/angular-cli/pull/14473 & https://github.com/angular/angular/pull/37382

BREAKING CHANGE: Reflect metadata polyfill is no longer automatically provided in JIT mode
Reflect metadata support is not required by Angular in JIT applications compiled by the CLI.
Applications built in AOT mode did not and will continue to not provide the polyfill.
For the majority of applications, the reflect metadata polyfill removal should have no effect.
However, if an application uses JIT mode and also uses the previously polyfilled reflect metadata JavaScript APIs, the polyfill will need to be manually added to the application after updating.
To replicate the previous behavior, the `core-js` package should be manually installed and the `import 'core-js/proposals/reflect-metadata';` statement should be added to the application's `polyfills.ts` file.
2022-03-23 12:58:55 -07:00
Tobias Speicher
137651645c refactor: replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-03-21 12:27:52 -07:00
Alan Agius
e28c715972 fix(@angular-devkit/build-angular): ignore css only chunks during naming
Don't name CSS only chunks.

Closes #22769
2022-03-04 16:58:38 +01:00
Alan Agius
de14293083 fix(@angular-devkit/build-angular): don't rename blocks which have a name
When using the unsupported `webpackChunkName` magic comment we renamed the chunk which in some cases causes a runtime error.

Closes #22525
2022-02-22 16:30:59 -05:00
Alan Agius
7ce50002a2 fix(@angular-devkit/build-angular): block Karma from starting until build is complete
This change is inspired by https://github.com/karma-runner/karma-chrome-launcher/issues/154#issuecomment-986661937 which blocks Karma from launching the browsers until the compilation is complete.

This is needed especially for large applications when using code-coverage where otherwise the users would have to fine-tune several Karma timeouts such as  `captureTimeout` for various environments.

Closes #22495
2022-02-09 11:15:37 +00:00
Alan Agius
4b9199d97f fix(@angular-devkit/build-angular): ensure to use content hash as filenames hashing mechanism
Previously we used hash which resulted in a unique hash generated for every build even when the contents of the files didn't differ.

More info: https://webpack.js.org/guides/caching/#output-filenames
2022-02-01 17:12:04 -08:00
Alan Agius
1842bd5d53 fix(@angular-devkit/build-angular): add whatwg-url to downlevel exclusion list
Similar to https://github.com/angular/angular-cli/pull/21739, `whatwg-url` seems to suffer from the same issue as https://github.com/angular/angular-cli/issues/21735

```ts
const AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(async function* () {}).prototype);
```
2022-02-01 17:00:58 -08:00
Alan Agius
0a1cd584d8 refactor(@angular-devkit/build-angular): remove deprecated showCircularDependencies browser and server builder option
BREAKING CHANGE:

The deprecated `showCircularDependencies` browser and server builder option has been removed. The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tools.
2022-01-31 11:34:58 -08:00
Alan Agius
d23a168b8d feat(@angular-devkit/build-angular): validate file extensions for scripts and styles options
In some cases unexpected files may be provided which can cause to unsupported or broken behaviour.

One such use-case is users can provide TypeScript files as `scripts` input, this would not be processed by the TypeScript compiler, see: https://github.com/angular/angular-cli/issues/17125 and would cause the build to fail with a an unhelpful error message during optimization as the JS optimizers cannot parse TypeScript input.

BREAKING CHANGE:

`browser` and `karma` builders `script` and `styles` options input files extensions are now validated.

Valid extensions for `scripts` are:
- `.js`
- `.cjs`
- `.mjs`
- `.jsx`
- `.cjsx`
- `.mjsx`

Valid extensions for `styles` are:
- `.css`
- `.less`
- `.sass`
- `.scss`
- `.styl`
2022-01-31 11:30:10 -08:00
Alan Agius
7f67dbc1cf fix(@angular-devkit/build-angular): invalid browsers version ranges
This change addresses the `Invalid version: "15.2-15.3"` range error. We previously only handled version ranges for `ios_safari`. Now, we handle such versions for all browsers.

Closes #22606
2022-01-31 09:14:43 -08:00
Alan Agius
07e776ea37 fix(@angular-devkit/build-angular): fail build when importing CSS files as an ECMA modules
BREAKING CHANGE:

We now issue a build time error since importing a CSS file as an ECMA module is non standard Webpack specific feature, which is not supported by the Angular CLI.

This feature was never truly supported by the Angular CLI, but has as such for visibility.
2022-01-27 11:07:32 -08:00
Alan Agius
b6886cea52 refactor(@angular-devkit/build-angular): refactor mini-css-extract-plugin import to ES6
`mini-css-extract-plugin` now ships its own types.
2022-01-19 07:21:10 +01:00
Alan Agius
a35262e6a5 refactor(@angular-devkit/build-angular): exit early when there are no component style budgets
With this change we exit the function early, when there are no budgets defined.
2022-01-16 19:41:13 +00:00
Alan Agius
b5c4a23446 fix(@angular-devkit/build-angular): support ESNext as target for JavaScript optimizations
Previously, when ESNext was used, we fallbacked to ES2020 which caused ESBuild to output broken code.

Closes #22486
2022-01-16 19:40:29 +00:00