mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-22 15:02:11 +08:00
fix(@angular-devkit/build-angular): configure webpack target in common configuration
Previously, `target` was unset for `test` which caused the target to be set incorrectly. Closes #21239
This commit is contained in:
parent
6a2b11906e
commit
070a133647
@ -81,10 +81,6 @@ export function getBrowserConfig(wco: WebpackConfigOptions): webpack.Configurati
|
||||
resolve: {
|
||||
mainFields: ['es2015', 'browser', 'module', 'main'],
|
||||
},
|
||||
target:
|
||||
wco.tsConfig.options.target === ScriptTarget.ES5 || buildBrowserFeatures.isEs5SupportNeeded()
|
||||
? ['web', 'es5']
|
||||
: 'web',
|
||||
output: {
|
||||
crossOriginLoading,
|
||||
trustedTypes: 'angular#bundler',
|
||||
|
@ -40,7 +40,6 @@ import {
|
||||
maxWorkers,
|
||||
persistentBuildCacheEnabled,
|
||||
profilingEnabled,
|
||||
shouldBeautify,
|
||||
} from '../../utils/environment-options';
|
||||
import { findAllNodeModules } from '../../utils/find-up';
|
||||
import { Spinner } from '../../utils/spinner';
|
||||
@ -358,12 +357,19 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
|
||||
return {
|
||||
mode: scriptsOptimization || stylesOptimization.minify ? 'production' : 'development',
|
||||
devtool: false,
|
||||
target: [
|
||||
platform === 'server' ? 'node' : 'web',
|
||||
tsConfig.options.target === ScriptTarget.ES5 ||
|
||||
(platform !== 'server' && buildBrowserFeatures.isEs5SupportNeeded())
|
||||
? 'es5'
|
||||
: 'es2015',
|
||||
],
|
||||
profile: buildOptions.statsJson,
|
||||
resolve: {
|
||||
roots: [projectRoot],
|
||||
extensions: ['.ts', '.tsx', '.mjs', '.js'],
|
||||
symlinks: !buildOptions.preserveSymlinks,
|
||||
modules: [wco.tsConfig.options.baseUrl || projectRoot, 'node_modules'],
|
||||
modules: [tsConfig.options.baseUrl || projectRoot, 'node_modules'],
|
||||
},
|
||||
resolveLoader: {
|
||||
symlinks: !buildOptions.preserveSymlinks,
|
||||
|
@ -35,7 +35,6 @@ export function getServerConfig(wco: WebpackConfigOptions): Configuration {
|
||||
resolve: {
|
||||
mainFields: ['es2015', 'main', 'module'],
|
||||
},
|
||||
target: 'node',
|
||||
output: {
|
||||
libraryTarget: 'commonjs',
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user