Skip to content

Commit

Permalink
fix(dts): use real path
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Nov 17, 2021
1 parent 9b49df4 commit d079b9b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/rollup/ts-resolve.ts
@@ -1,3 +1,4 @@
import fs from 'fs'
import path from 'path'
import { PluginImpl } from 'rollup'
import _resolve from 'resolve'
Expand Down Expand Up @@ -55,7 +56,9 @@ export const tsResolvePlugin: PluginImpl<TsResolveOptions> = ({
// Skip absolute path
if (path.isAbsolute(source)) return null

const basedir = importer ? path.dirname(importer) : process.cwd()
const basedir = importer
? await fs.promises.realpath(path.dirname(importer))
: process.cwd()

// A relative path
if (source[0] === '.') {
Expand All @@ -81,7 +84,7 @@ export const tsResolvePlugin: PluginImpl<TsResolveOptions> = ({
basedir,
extensions: resolveExtensions,
packageFilter(pkg) {
pkg.main = pkg.types || pkg.typings || pkg.module || pkg.main
pkg.main = pkg.types || pkg.typings
return pkg
},
paths: ['node_modules', 'node_modules/@types'],
Expand Down

1 comment on commit d079b9b

@vercel
Copy link

@vercel vercel bot commented on d079b9b Nov 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.