File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -177,21 +177,23 @@ export class TypegenPrinter {
177
177
)
178
178
}
179
179
180
- if ( isNodeModule ( rootTypePath ) ) {
180
+ if ( path . isAbsolute ( rootTypePath ) ) {
181
+ if ( ! fs . existsSync ( rootTypePath ) ) {
182
+ throw new Error ( `Root typing path ${ rootTypePath } for the type ${ typeName } does not exist` )
183
+ }
184
+ } else {
181
185
try {
182
186
require . resolve ( rootTypePath )
183
187
} catch ( e ) {
184
188
throw new Error ( `Module ${ rootTypePath } for the type ${ typeName } does not exist` )
185
189
}
186
- } else if ( ! fs . existsSync ( rootTypePath ) ) {
187
- throw new Error ( `Root typing path ${ rootTypePath } for the type ${ typeName } does not exist` )
188
190
}
189
191
190
- const importPath = isNodeModule ( rootTypePath )
191
- ? rootTypePath
192
- : relativePathTo ( rootTypePath , outputPath )
192
+ const importPath = path . isAbsolute ( rootTypePath )
193
+ ? relativePathTo ( rootTypePath , outputPath )
193
194
. replace ( / ( \. d ) ? \. t s / , '' )
194
195
. replace ( / \\ + / g, '/' )
196
+ : rootTypePath
195
197
196
198
importMap [ importPath ] = importMap [ importPath ] || new Set ( )
197
199
importMap [ importPath ] . add ( rootType . alias ? `${ rootType . name } as ${ rootType . alias } ` : rootType . name )
You can’t perform that action at this time.
0 commit comments