1 year ago
#368585
Kishor Shrestha
How do you maintain directory structure when creating libraries in TS using bundlers like Rollup or Webpack?
I have created a React UI library to share components between different projects in my organization. But, when importing the components I always have to
import {Module} from "my-package"
because when building using Rollup or Webpack, it only outputs a single bundle. (more if splitting is involved)
This is not optimal. It works but it is not tree-shakeable. How do I preserve the directory structure when build the library or is there any other way to make my imports the following way which is tree shakeable.
import Module from "my-package/Module"
Thank you in advance
javascript
typescript
webpack
bundler
rollup
0 Answers
Your Answer