Skip to content

Commit 6340666

Browse files
authored
refactor: move baseUrl fallback logic to paths-plugin.ts
This ensure that we do not set `baseUrl` internally which would trigger a deprecation warning.
1 parent 843ca01 commit 6340666

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

packages/angular_devkit/build_angular/src/builders/browser/specs/tsconfig-paths_spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@ describe('Browser Builder tsconfig paths', () => {
4646
const tsconfig = JSON.parse(virtualFs.fileBufferToString(host.scopedSync().read(tsconfigPath)));
4747
tsconfig.compilerOptions ??= {};
4848
tsconfig.compilerOptions.paths = {
49-
'@shared': ['src/app/shared'],
50-
'@shared/*': ['src/app/shared/*'],
51-
'*': ['*', 'src/app/shared/*'],
49+
'@shared': ['./src/app/shared'],
50+
'@shared/*': ['./src/app/shared/*'],
51+
'*': ['./*', './src/app/shared/*'],
5252
};
5353
host
5454
.scopedSync()
5555
.write(tsconfigPath, virtualFs.stringToFileBuffer(JSON.stringify(tsconfig, null, 2)));
56+
5657
host.appendToFile(
5758
'src/app/app.component.ts',
5859
`

packages/angular_devkit/build_angular/src/builders/browser/tests/options/allowed-common-js-dependencies_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
122122
const tsconfig = JSON.parse(content);
123123
tsconfig.compilerOptions ??= {};
124124
tsconfig.compilerOptions.paths = {
125-
'@app/*': ['src/app/*'],
125+
'@app/*': ['./src/app/*'],
126126
};
127127

128128
return JSON.stringify(tsconfig, null, 2);

packages/ngtools/webpack/src/ivy/plugin.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ export class AngularWebpackPlugin {
410410
this.pluginOptions.tsconfig,
411411
this.pluginOptions.compilerOptions,
412412
);
413-
compilerOptions.baseUrl ??= compilerOptions['pathsBasePath'];
414413
compilerOptions.composite = false;
415414
compilerOptions.noEmitOnError = false;
416415
compilerOptions.suppressOutputPathCheck = true;

packages/ngtools/webpack/src/paths-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class TypeScriptPathsPlugin {
4545
* @param options The `paths` and `baseUrl` options from TypeScript's `CompilerOptions`.
4646
*/
4747
update(options: TypeScriptPathsPluginOptions): void {
48-
this.baseUrl = options.baseUrl;
48+
this.baseUrl = options.baseUrl ?? (options as Record<string, string>)['pathsBasePath'];
4949
this.patterns = undefined;
5050

5151
if (options.paths) {

0 commit comments

Comments
 (0)