Skip to content

Commit e95b73f

Browse files
committed
refactor(@angular-devkit/build-angular): set resolve roots to projectRoot
Previously roots was the same as context which was set to projectRoot, however in the previous change we changed the context to workspaceRoot. With this change we maintain the same resolve root setting. More info: https://github.com/webpack/webpack/blob/4a3e4bda6b30915afd92f0b3c2aff5add149a635/lib/config/defaults.js#L875 https://webpack.js.org/configuration/resolve/
1 parent 086d74d commit e95b73f

File tree

1 file changed

+5
-1
lines changed
  • packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs

1 file changed

+5
-1
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
compilation,
2525
debug,
2626
} from 'webpack';
27+
import webpack = require('webpack');
2728
import { RawSource } from 'webpack-sources';
2829
import { AssetPatternClass } from '../../../browser/schema';
2930
import { BuildBrowserFeatures, maxWorkers } from '../../../utils';
@@ -471,13 +472,16 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
471472
devtool: false,
472473
profile: buildOptions.statsJson,
473474
resolve: {
475+
roots: [projectRoot],
474476
extensions: ['.ts', '.tsx', '.mjs', '.js'],
475477
symlinks: !buildOptions.preserveSymlinks,
476478
modules: [wco.tsConfig.options.baseUrl || projectRoot, 'node_modules'],
477479
plugins: [
478480
PnpWebpackPlugin,
479481
],
480-
},
482+
// Cast since roots is currently not in typings
483+
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/47233
484+
} as webpack.Resolve,
481485
resolveLoader: {
482486
symlinks: !buildOptions.preserveSymlinks,
483487
modules: [

0 commit comments

Comments
 (0)