vite icon indicating copy to clipboard operation
vite copied to clipboard

fix: `esbuildOutputFromId` for symlinked root (fix #9327)

Open htmlin opened this issue 1 year ago • 1 comments

Description

Positioning information on #9327 :

  1. Since my project uses pnpm, there are a lot of symlinked dependencies.
  2. This issue is intermittent but occurs very frequently, and it often stems from react dependency. It's in peerDeps.
  3. I'm using a workspace, and the issue seems to arise because the packages/user directory is missing in cwd during output parsing.
for (const [key, value] of Object.entries(outputs)) {
  if (normalizePath$3(path$n.relative(cwd, key)) === normalizedOutputPath) {
    return value;
  } else {
    console.log('cwd: ', cwd) // /Users/linhuangdong/Git/projectRoot
    console.log('key: ', key) // ../user/node_modules/.vite/deps_temp_ee3bd11b/react.js
    console.log('normalizedOutputPath: ', normalizedOutputPath) // packages/user/node_modules/.vite/deps_temp_ee3bd11b/react.js
  }
}

htmlin avatar Aug 29 '24 08:08 htmlin

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.