File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -22,22 +22,24 @@ export function autoServicesPlugin(servicesDir: string): Plugin {
2222 const typeFiles = files . filter ( ( f ) => f . endsWith ( ".types.ts" ) ) ;
2323
2424 // Generate index.ts (imports implementations for auto-registration)
25+ const serviceImports = serviceFiles
26+ . map ( ( f ) => `import "./${ f . replace ( ".ts" , ".js" ) } ";` )
27+ . join ( "\n" ) ;
2528 const indexContent = `/**
2629 * Auto-register all IPC services
2730 * This file is auto-generated by vite-plugin-auto-services.ts
2831 */
29-
30- ${ serviceFiles . map ( ( f ) => `import "./${ f . replace ( ".ts" , ".js" ) } ";` ) . join ( "\n" ) }
31- ` ;
32+ ${ serviceImports ? `\n${ serviceImports } \n` : "" } `;
3233
3334 // Generate types.ts (imports type files for declaration merging)
35+ const typeImports = typeFiles
36+ . map ( ( f ) => `import "./${ f . replace ( ".ts" , ".js" ) } ";` )
37+ . join ( "\n" ) ;
3438 const typesContent = `/**
3539 * Auto-import all IPC service types for declaration merging
3640 * This file is auto-generated by vite-plugin-auto-services.ts
3741 */
38-
39- ${ typeFiles . map ( ( f ) => `import "./${ f . replace ( ".ts" , ".js" ) } ";` ) . join ( "\n" ) }
40- ` ;
42+ ${ typeImports ? `\n${ typeImports } \n` : "" } `;
4143
4244 // Check if content actually changed before writing
4345 const indexPath = join ( servicesDir , "index.ts" ) ;
You can’t perform that action at this time.
0 commit comments