feat: externalize peerDependencies (#132)

This commit is contained in:
Anthony Fu 2020-09-16 21:53:46 +08:00 committed by GitHub
parent 298eb7c3ff
commit c1983b878a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -44,7 +44,7 @@ Code splitting is enabled by default and supported in `cjs` and `esm` format.
### Excluding packages
By default tsup bundles all `import`-ed modules but `dependencies` in your `packages.json` are always excluded, you can also use `--external <module>` flag to mark other packages as external.
By default tsup bundles all `import`-ed modules but `dependencies` and `peerDependencies` in your `packages.json` are always excluded, you can also use `--external <module>` flag to mark other packages as external.
### Generate declaration file

View File

@ -65,7 +65,10 @@ export function loadTsConfig(cwd: string) {
export async function getDeps(cwd: string) {
const data = await loadPkg(cwd)
const deps = Object.keys(data.dependencies || {})
const deps = Array.from(new Set([
...Object.keys(data.dependencies || {}),
...Object.keys(data.peerDependencies || {})
]))
return deps
}