I have a monorepo, and I want to store my reusable tsup configs in a separate package to avoid having to duplicate configs. I want to do so without having to build the package every time (use tsup to compile tsup configs is quite an overkill, that's how I did it before).
The only thing I changed compared to my previous build first approach is the "main" field, it was "main": "./dist/index.js".
Now the package.json in @repo/tsup-config package contains fields:
When I import it inside anothe package in a tsup.config.ts as:
import { defineConfig, type Options } from 'tsup';
import { base } from '@repo/tsup-config';
export default defineConfig((options: Options) => ({
...base,
...options,
}));
However, it throws: Unknown file extension ".ts".
Interestingly, if I move the exact same fie (that exports base, containing the reusable tsup config) to src, and import it as import { base } from '@/base'; (using absolute path here too, I was thinking maybe that's the issue), it works fine.
Any suggestions?
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
Hi!
I have a monorepo, and I want to store my reusable tsup configs in a separate package to avoid having to duplicate configs. I want to do so without having to build the package every time (use tsup to compile tsup configs is quite an overkill, that's how I did it before).
The only thing I changed compared to my previous build first approach is the "main" field, it was
"main": "./dist/index.js"
.Now the package.json in
@repo/tsup-config
package contains fields:When I import it inside anothe package in a
tsup.config.ts
as:However, it throws:
Unknown file extension ".ts"
.Interestingly, if I move the exact same fie (that exports
base
, containing the reusable tsup config) tosrc
, and import it asimport { base } from '@/base';
(using absolute path here too, I was thinking maybe that's the issue), it works fine.Any suggestions?
Upvote & Fund