Skip to content

Commit f2ce053

Browse files
alan-agius4clydin
authored andcommitted
fix(@angular-devkit/build-angular): explicitly set compilation target in test configuration
When not set, and browserslist returns no reesults due to the file being empty or commented. Webpack will generate invalid code because it doesn't know which enviorment we want to target. ```diff - (self["webpackChunktest_app"] = self["webpackChunktest_app"] || []).push([["vendor"],{ /***/ 8583: ``` Closes #21111 (cherry picked from commit 8360251)
1 parent 427c422 commit f2ce053

File tree

1 file changed

+2
-0
lines changed
  • packages/angular_devkit/build_angular/src/webpack/configs

1 file changed

+2
-0
lines changed

packages/angular_devkit/build_angular/src/webpack/configs/test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import * as glob from 'glob';
1010
import * as path from 'path';
11+
import { ScriptTarget } from 'typescript';
1112
import * as webpack from 'webpack';
1213
import { WebpackConfigOptions, WebpackTestOptions } from '../../utils/build-options';
1314
import { getSourceMapDevTool, isPolyfillsEntry } from '../utils/helpers';
@@ -51,6 +52,7 @@ export function getTestConfig(
5152

5253
return {
5354
mode: 'development',
55+
target: wco.tsConfig.options.target === ScriptTarget.ES5 ? ['web', 'es5'] : 'web',
5456
resolve: {
5557
mainFields: ['es2015', 'browser', 'module', 'main'],
5658
},

0 commit comments

Comments
 (0)