how to keep original directory structure?
See original GitHub issuesrc
- tool1
- tool1.ts
- tool2
- tool2.ts
- tool3
- tool3.ts
- index.ts
Such as above, src/index.ts
is exports
all, then use tsup src/index.ts --format esm,cjs,iife
build,it will output:
dist
- index.mjs
- index.global.js
- index.js
it not I want.
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:12 (2 by maintainers)
Top Results From Across the Web
How to copy an entire folder structure without ...
Now open a Windows command window and run the following command. It's the /T option that copies just the folder structure not the...
Read more >Find Files Faster: How to Organize Files and Folders
The first step to building an effective folder structure is figuring out your top-level folder. Do you want to simply make a new...
Read more >How to copy files while maintaining original folder structure?
The best way I have found to transfer that kind of data while maintaining the folder structure is through Robocopy.
Read more >Copying Directory Structures without Files in Windows
To use, select the structure to copy in FreeCommander's left pane and select the target directory in the right pane. Select and click...
Read more >Structured Copying
First create a File Set with the 'Pictures' folder as the root of the search. Then select the files to be copied: and...
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
use
bundle: false
andentry: ['./src/**/*.ts']
also work, but I have another problem:compilerOptions.paths
not resolvedMaybe to elaborate, this seems appropriate when building libraries of React component or libraries of independant utilities (lodash style), see: https://stackoverflow.com/questions/72149666/a-fool-proof-tsup-config-for-a-react-component-library In this case you want to generate one .js per component.
We seem to need:
bundle: false
to disable bundling and keep only the transpiling step.I still struggle to keep the directory structure. If entry is
["index.ts", "./smth/nested.ts"]
, thesmth
folder will be created. But this is probably not what you want since you need no bundling for index, and bundling for “nested”. If entry is["./smth/nested.ts"]
it won’t respect the directory structure.Edit: here is the final result. Components are bundled with code splitting (in case 2 components use the same internal sub component for instance), index files are not bundled, only transpiled, and uses an explicit “.js” which is necessary for ESM modules to work. I am surprised that the “.js” extension is accepted by TypeScript, but it works. Named import works as expected, and tree shaking is now possible because each component leaves in an isolated ES module. This is not perfect but a good first step.