fix(core): replace posix.relative with relative for path resolution (#30783)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> Whenever using the new Typescript style repos (using package.json instead of project.json for typescript projects), we get incorrect paths when using `resolveImportWithRequire` on Windows. Currently when trying to find a path, we end up with a path similar to `../C:\\dev\\nx\\file.ts` which is incorrect. ## Expected Behavior Changing `posix.relative` to just relative, allows us to get the proper path on Windows like so: `.\\file.ts` ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes # Co-authored-by: Jack Hsu <jack.hsu@gmail.com> Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
This commit is contained in:
parent
6176d3a504
commit
525bcca0a0
@ -397,7 +397,7 @@ export class TargetProjectLocator {
|
||||
normalizedImportExpr: string,
|
||||
filePath: string
|
||||
) {
|
||||
return posix.relative(
|
||||
return relative(
|
||||
workspaceRoot,
|
||||
require.resolve(normalizedImportExpr, {
|
||||
paths: [dirname(filePath)],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user