Excluding files from the build
See original GitHub issueHello
How can we exclude files from compilation (for example test files ending with .spec.ts)? I tried https://github.com/egoist/tsup/issues/415 but it errored:
ESM Build failed
Error: Build failed with 1 error:
error: The entry point "./src/api.spec.ts" cannot be marked as external
Then I switched from using npx tsup src
to npx tsup src/index.ts
and I got an error that other files are imported but are not entrypoints.
src/index.ts(1,15): error TS6307: File '<redacted>/src/endpoints.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
The file is in the program because:
Imported via './endpoints' from file '<redacted>/src/index.ts'
Imported via './endpoints' from file '<redacted>/api.ts'
src/index.ts(3,15): error TS6307: File '<redacted>/src/api.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
Then I tried to “include” everything under “./src” in tsconfig.json, but it didn’t help.
Then I tried to use the glob library to exactly specify my import files and exclude test files, but I don’t think tsup supports asynchronous configs?
Is there a way to exclude files within the src directory (preferably without creating a node script that calls tsup’s “build” directly)?
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to exclude files from Visual Studio compile?
Right click the file, select 'Exclude From Project' · Right click the file, select 'Properties' --> select 'Configuration Properties' --> select ...
Read more >How to: Exclude Files from the Build - MSBuild | Microsoft Learn
Use conditions to exclude a file or directory from the inputs for a build ... If there are items that you want to...
Read more >Exclude from Build - Visual Studio Marketplace
Select directories and/or files you'd like to exclude or include · Right-click the selection or go to menu Tools · Choose Exclude from...
Read more >Excluding a folder from build. : r/VisualStudio - Reddit
How do I exclude a folder from being built for a while? I don't want to exclude it from the project as I...
Read more >Excluding files or folders from builds - IBM Streams
To exclude files or folders when building a SPL application or toolkit, create a .buildignore file in the root of your SPL application...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tenshouuu
ran into the same issue, and resolved it with a negative pattern, e.g.:
(looks like
tsup
is usingglobby
under the hood, thus its pattern features seem to work for theentry
config option)tsupConfig.external
doesn’t work for this case