Export submodules instead of all components in the root with tsdx
Asked Answered
G

0

6

Current Behavior

We are building shared-code projects with tsdx, and we only have one doubt, concern we can't get an answer. How to export subfolders for packages published with TSDX.

Let's use my previous example for the question. In the entry point of our project, we export those two components in the root.

And because of that, when you want to use them we have to import the components from the root of our library (usage example):

import { Thing, SimpleStyledH1Application } from "tsdx-styled-components"

We would like to know how to configure our entry point(s) so we can import our components from subfolders like

import { Thing } from "tsdx-styled-components/things"
import { SimpleStyledH1Application } from "tsdx-styled-components/styled"
import { CoreComponent } from "tsdx-styled-components"

Expected behavior/Suggested solution(s)

To have a guide/notes on how to add subfolders to the libraries we create, so it's easy (not only for me but for anyone using TSDX) how to create libraries with subfolders.

Additional context

  • I tried to change our rollup configuration following this thread but was not working and not sure if is the right/easier path to get it done.
  • There is a rollup plugin for that purpose, so something like that with the instructions on how to add in in our tsdx.config.js would be great.

Your environment

Example project:

https://github.com/robertovg/tsdx-styled-components/ https://github.com/robertovg/next-ts-styled-components-tsdx-host

This question was originally posted as an issue on tsdx but after a couple of months with no answer, I thought to move it here to see if someone has resolved the issue.

Gooseherd answered 2/3, 2021 at 10:52 Comment(1)
We moved from tsdx to weiran-zsd.github.io/dts-cli, but sill facing the same problem, it's not something urgent but if someone has a working example with path exports with tsdx, dts or rollup would be very nice.Gooseherd

© 2022 - 2024 — McMap. All rights reserved.