egoist / egoist/tsup

How can I make tsup resolve my typescript absolute import paths?

Open
#905 9 comments 38 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

:wave: Hi and thank you so much for your work ❤️ 🤟🏼

## Description
`tsup` is not resolving typescript absolute imports. I have a `tsconfig.json` that defines multiple absolute imports (see below). `tsup` bundles it without resolving for those absolute imports, so it causes errors when consuming the lib in other projects.

In your docs, I can see [NormalizedOptions](https://paka.dev/npm/tsup@6.7.0/api#ce641c2999db0918) - which uses `tsconfigResolvePaths` - but when I try to put it in my config (see below) typescript gets angry 😠:

> 'tsconfigResolvePaths' does not exist in type 'Options | Options[] | ((overrideOptions: Options) => MaybePromise)'

**tsconfig.json:**
```
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@services/*": [
"./services/*"
],
"@vendors/*": [
"./vendors/*"
],
// ....
},
```

**tsup.config.json:**
```
import { defineConfig } from 'tsup';

export default defineConfig({
entry: {
index: 'index.ts',
'services/marketing/index': 'services/marketing/index.ts',
'vendors/index': 'vendors/index.ts',
},
tsconfig: './tsconfig.json',
splitting: false,
sourcemap: true,
clean: true,
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.