Skip to content

Commit

Permalink
fix: do not use preserveSymlinks: true when bundling dts file
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Nov 12, 2021
1 parent e487ffe commit 112fbf6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import fs from 'fs'
import { defineConfig } from './src'

export default defineConfig({
esbuildPlugins: [
{
name: 'patch-rollup-plugin-dts',
setup(build) {
let removed = false
build.onLoad({ filter: /rollup-plugin-dts/ }, async (args) => {
const code = await fs.promises.readFile(args.path, 'utf-8')
const RE = /preserveSymlinks:\s+true,/
if (RE.test(code)) {
removed = true
}
return {
contents: code.replace(RE, ''),
loader: 'js',
}
})
build.onEnd(() => {
if (!removed) {
throw new Error('rollup-plugin-dts was not patched')
}
})
},
},
],
})

1 comment on commit 112fbf6

@vercel
Copy link

@vercel vercel bot commented on 112fbf6 Nov 12, 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.