Skip to content

Commit

Permalink
Merge pull request #2788 from boundstate/fix-plugin-win-paths
Browse files Browse the repository at this point in the history
fix(plugin): don't prefix absolute win paths
  • Loading branch information
kamilmysliwiec committed Apr 24, 2023
2 parents d556146 + e0b504d commit 361b059
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/graphql/lib/plugin/utils/plugin-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { head } from 'lodash';
import { posix } from 'path';
import { isAbsolute, posix } from 'path';
import * as ts from 'typescript';
import {
getText,
Expand Down Expand Up @@ -109,7 +109,10 @@ export function replaceImportPath(typeReference: string, fileName: string) {
importPath = importPath.slice(2, importPath.length - 1);

let relativePath = posix.relative(posix.dirname(fileName), importPath);
relativePath = relativePath[0] !== '.' ? './' + relativePath : relativePath;
relativePath =
!isAbsolute(relativePath) && relativePath[0] !== '.'
? './' + relativePath
: relativePath;

const nodeModulesText = 'node_modules';
const nodeModulePos = relativePath.indexOf(nodeModulesText);
Expand Down

0 comments on commit 361b059

Please sign in to comment.