Skip to content

Commit e885819

Browse files
committed
- Possible fix to write .d.ts near the original source file
1 parent 33c866f commit e885819

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9+
import * as fs from 'node:fs';
910
import * as path from 'node:path';
1011
import type { LoaderContext } from 'webpack';
1112
import { AngularPluginSymbol, FileEmitterCollection } from './symbol';
@@ -72,6 +73,10 @@ export function angularWebpackLoader(
7273
);
7374
}
7475

76+
// Write the declaration file in the target dir
77+
if (result.declaration) {
78+
fs.writeFileSync(this.resourcePath.replace('.ts', '.d.ts'), result.declaration);
79+
}
7580
callback(undefined, resultContent, resultMap);
7681
})
7782
.catch((err) => {

0 commit comments

Comments
 (0)