Skip to content

Commit f3d13c2

Browse files
authored
fix(dts-plugin): ensure dts file path if it has deep path (#2772)
1 parent 9d46f11 commit f3d13c2

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

.changeset/afraid-chefs-yell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/dts-plugin': patch
3+
---
4+
5+
fix(dts-plugin): ensure dts file path if it has deep path

packages/dts-plugin/src/core/lib/DTSManager.advance.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ describe('DTSManager advance usage', () => {
7070
remoteOptions.typesFolder,
7171
);
7272
await dtsManager.generateTypes();
73+
console.log('generateTypes done');
7374

7475
const apiFile = `${distFolder}.d.ts`;
7576
expect(readFileSync(apiFile, 'utf8')).toEqual(`

packages/dts-plugin/src/core/lib/DTSManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class DTSManager {
140140
return;
141141
}
142142

143-
this.extractRemoteTypes({
143+
await this.extractRemoteTypes({
144144
remoteOptions,
145145
tsConfig,
146146
mapComponentsToExpose,

packages/dts-plugin/src/core/lib/typeScriptCompiler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ const processTypesFile = async (options: {
129129
.replace(STARTS_WITH_SLASH, '')
130130
.split(sep) // Windows platform-specific file system path fix
131131
.join('/');
132+
ensureDirSync(mfeTypeEntryDirectory);
132133
await writeFile(
133134
mfeTypeEntry,
134135
`export * from './${relativePathToOutput}';\nexport { default } from './${relativePathToOutput}';`,

packages/dts-plugin/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import { defineConfig } from 'vite';
44
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
55

66
export default defineConfig({
7-
cacheDir: '../../node_modules/.vitest/dts-plugin',
7+
cacheDir: '../../node_modules/.vite/dts-plugin',
88

99
plugins: [nxViteTsPaths()],
1010

1111
test: {
12+
// cache: false,
1213
cache: {
1314
dir: '../../node_modules/.vitest',
1415
},

0 commit comments

Comments
 (0)