diff --git a/packages/angular_devkit/build_angular/src/builders/browser/specs/tsconfig-paths_spec.ts b/packages/angular_devkit/build_angular/src/builders/browser/specs/tsconfig-paths_spec.ts index c40337393a5e..80285bf5499d 100644 --- a/packages/angular_devkit/build_angular/src/builders/browser/specs/tsconfig-paths_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/browser/specs/tsconfig-paths_spec.ts @@ -46,13 +46,14 @@ describe('Browser Builder tsconfig paths', () => { const tsconfig = JSON.parse(virtualFs.fileBufferToString(host.scopedSync().read(tsconfigPath))); tsconfig.compilerOptions ??= {}; tsconfig.compilerOptions.paths = { - '@shared': ['src/app/shared'], - '@shared/*': ['src/app/shared/*'], - '*': ['*', 'src/app/shared/*'], + '@shared': ['./src/app/shared'], + '@shared/*': ['./src/app/shared/*'], + '*': ['./*', './src/app/shared/*'], }; host .scopedSync() .write(tsconfigPath, virtualFs.stringToFileBuffer(JSON.stringify(tsconfig, null, 2))); + host.appendToFile( 'src/app/app.component.ts', ` diff --git a/packages/angular_devkit/build_angular/src/builders/browser/tests/options/allowed-common-js-dependencies_spec.ts b/packages/angular_devkit/build_angular/src/builders/browser/tests/options/allowed-common-js-dependencies_spec.ts index 5389a1457673..b0e89583bb63 100644 --- a/packages/angular_devkit/build_angular/src/builders/browser/tests/options/allowed-common-js-dependencies_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/browser/tests/options/allowed-common-js-dependencies_spec.ts @@ -122,7 +122,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => { const tsconfig = JSON.parse(content); tsconfig.compilerOptions ??= {}; tsconfig.compilerOptions.paths = { - '@app/*': ['src/app/*'], + '@app/*': ['./src/app/*'], }; return JSON.stringify(tsconfig, null, 2); diff --git a/packages/ngtools/webpack/src/ivy/plugin.ts b/packages/ngtools/webpack/src/ivy/plugin.ts index ac52c4188c3e..f46b1360f26a 100644 --- a/packages/ngtools/webpack/src/ivy/plugin.ts +++ b/packages/ngtools/webpack/src/ivy/plugin.ts @@ -410,7 +410,6 @@ export class AngularWebpackPlugin { this.pluginOptions.tsconfig, this.pluginOptions.compilerOptions, ); - compilerOptions.baseUrl ??= compilerOptions['pathsBasePath']; compilerOptions.composite = false; compilerOptions.noEmitOnError = false; compilerOptions.suppressOutputPathCheck = true; diff --git a/packages/ngtools/webpack/src/paths-plugin.ts b/packages/ngtools/webpack/src/paths-plugin.ts index 612d70d4ad6e..063c96120d18 100644 --- a/packages/ngtools/webpack/src/paths-plugin.ts +++ b/packages/ngtools/webpack/src/paths-plugin.ts @@ -45,7 +45,7 @@ export class TypeScriptPathsPlugin { * @param options The `paths` and `baseUrl` options from TypeScript's `CompilerOptions`. */ update(options: TypeScriptPathsPluginOptions): void { - this.baseUrl = options.baseUrl; + this.baseUrl = options.baseUrl ?? (options as Record)['pathsBasePath']; this.patterns = undefined; if (options.paths) {