egoist / egoist/tsup

cannot recognize "extends" field inside tsconfig.json that will extends third-party as the base config

Open
#941 1 comment 5 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

imagine there is a monorepo, the structure is below:
- apps
- server
- tsconfig.json
- packages
- logger
- tsconfig
- base.json

the server app uses the tsconfig.json file that will extends the local package named "tsconfig" inside packages folder.
the code inside tsconfig.json file of server likes below:
```json
{
"extends": tsconfig/base.json
}
```
the package.json of server :
```
"devDependencies": {
"tsconfig": "workspace:*"
}
```
and then, I use the logger package in the server app with `import logger from '@jeditor/logger'` ,
by now ,everything is Ok, but when I use tsup to bundle my server app, it got an error shows "could not resolve @jeditor/logger"。

the base.json likes below:
```json
"baseUrl": "../../",
"paths": {
"@jeditor/*": ["packages/*/src"]
}
```
the baseUrl will point to monorepo root.

the tsup.config.ts likes below:
```ts
entry: ['src'],
splitting: true,
clean: true,
format: ['cjs'],
platform: 'node',
tsconfig: 'tsconfig.build.json',
bundle: true,
noExternal:["@jeditor/logger"],
dts: process.env.NODE_ENV === 'production' ? false : true,
sourcemap: process.env.NODE_ENV === 'production' ? false : true,
minify: process.env.NODE_ENV === 'production' ? 'terser' : false,
terserOptions: {
compress: true,
keep_classnames: false,
keep_fnames: false,
mangle: true,
sourceMap: false,
}
```

question: can tsup resolve the tsconfig that is the local pkg inside the monorepo? if tsup can resolved it, can tsup recognize the paths alias in the tsconfig/base.json?

error pic:
Screenshot 2023-06-30 at 17 12 17

Contributor guide

Open the contributing guide

Research direction

Reproduce the monorepo setup using apps/server/tsconfig.json, packages/tsconfig/base.json, tsconfig.build.json, and tsup.config.ts. Run the server bundle and inspect how the extended config and the @jeditor/* paths entry are handled; done means the reported @jeditor/logger resolution behavior is clearly confirmed or corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.