@@ -10,6 +10,7 @@ import {
10
10
generateTypes ,
11
11
generateTypesInChildProcess ,
12
12
retrieveTypesAssetsInfo ,
13
+ type DTSManagerOptions ,
13
14
} from '../core/index' ;
14
15
import path from 'path' ;
15
16
@@ -42,10 +43,14 @@ export class GenerateTypesPlugin implements WebpackPluginInstance {
42
43
return ;
43
44
}
44
45
45
- const finalOptions = {
46
+ const finalOptions : DTSManagerOptions = {
46
47
remote : {
47
48
implementation : dtsOptions . implementation ,
48
49
context : compiler . context ,
50
+ outputDir : path . relative (
51
+ compiler . context ,
52
+ compiler . outputPath || compiler . options . output . path ,
53
+ ) ,
49
54
moduleFederationConfig : pluginOptions ,
50
55
...normalizedGenerateTypes ,
51
56
} ,
@@ -74,8 +79,11 @@ export class GenerateTypesPlugin implements WebpackPluginInstance {
74
79
const generateTypesFn = getGenerateTypesFn ( ) ;
75
80
let compiledOnce = false ;
76
81
77
- const emitTypesFiles = async ( ) => {
82
+ const emitTypesFilesDev = async ( ) => {
78
83
try {
84
+ if ( ! isDev ( ) ) {
85
+ return ;
86
+ }
79
87
const { zipTypesPath, apiTypesPath, zipName, apiFileName } =
80
88
retrieveTypesAssetsInfo ( finalOptions . remote ) ;
81
89
@@ -166,7 +174,7 @@ export class GenerateTypesPlugin implements WebpackPluginInstance {
166
174
}
167
175
168
176
if ( compiledOnce ) {
169
- emitTypesFiles ( ) ;
177
+ emitTypesFilesDev ( ) ;
170
178
return ;
171
179
}
172
180
0 commit comments