Skip to content

Commit

Permalink
fix: preserve symlinks in resolver for yarn pnp virtual compat (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreBonaventure authored Jun 24, 2020
1 parent 0ff8ae3 commit ba2f91d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/node/utils/pathUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ import resolve from 'resolve'
import { supportedExts } from '../resolver'
import { Context } from '../server'

let isRunningWithYarnPnp: boolean
try {
isRunningWithYarnPnp = Boolean(require('pnpapi'))
} catch {}

export const resolveFrom = (root: string, id: string) =>
resolve.sync(id, {
basedir: root,
extensions: supportedExts,
// necessary to work with pnpm
preserveSymlinks: false
preserveSymlinks: isRunningWithYarnPnp || false
})

export const queryRE = /\?.*$/
Expand Down

0 comments on commit ba2f91d

Please sign in to comment.