Custom Loader - `copy` loaders appear to break importing other things?
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
When I set the loader in tsup.config.ts with:
```
loader: {
".svg": "copy",
".png": "copy",
".gif": "copy",
".md": "copy",
".pdf": "copy",
".jpg": "copy",
".jpeg": "copy",
},
```
The build fails claiming it can't find the `index.ts` files anymore (for `export * from "./dirName";`). Seems like specifying the `copy`/asset loaders is breaking the loaders for other file extensions.
Is there a way to access the existing loader, and just merge these entries into it? -- When I use the passed in tsup config (by using the function-parameter version of `defineConfig`, the object is blank / only contains `{ '--': [], watch: true }`)
Affects `tsup@8.4.0` and `tsup@8.0.2`
Contributor guide
Research direction
Start by reproducing the build with the listed loader entries in tsup.config.ts and an export from './dirName' that resolves to index.ts. Inspect the function-parameter form of defineConfig and how its loader settings interact with existing loaders. Done means the asset loaders coexist with the defaults and the affected exports build successfully.
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
- Mostly clear
- Newbie friendliness
- 35/100