fix(node) executor bug on Windows (#15368)

This commit is contained in:
Binyamin Yawitz 2023-03-02 21:05:36 -05:00 committed by GitHub
parent a5a64cd5be
commit a7738caa70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ import * as esbuild from 'esbuild';
import * as path from 'path'; import * as path from 'path';
import { join, parse } from 'path'; import { join, parse } from 'path';
import { import {
normalizePath,
ExecutorContext, ExecutorContext,
joinPathFragments, joinPathFragments,
ProjectGraphProjectNode, ProjectGraphProjectNode,
@ -197,6 +198,8 @@ export function getRegisterFileContent(
mainFile: string, mainFile: string,
outExtension = '.js' outExtension = '.js'
) { ) {
mainFile = normalizePath(mainFile);
// Sort by longest prefix so imports match the most specific path. // Sort by longest prefix so imports match the most specific path.
const sortedKeys = Object.keys(paths).sort( const sortedKeys = Object.keys(paths).sort(
(a: string, b: string) => getPrefixLength(b) - getPrefixLength(a) (a: string, b: string) => getPrefixLength(b) - getPrefixLength(a)