rob*_*ovg 5 javascript module typescript npm-publish tsdx
我们正在使用 tsdx 构建共享代码项目,我们只有一个疑问,担心我们无法得到答案。如何导出使用 TSDX 发布的包的子文件夹。
让我们用我之前的例子来回答这个问题。在我们项目的入口点,我们将这两个组件导出到根目录中。
因此,当您想使用它们时,我们必须从库的根目录导入组件(使用示例):
import { Thing, SimpleStyledH1Application } from "tsdx-styled-components"
Run Code Online (Sandbox Code Playgroud)
我们想知道如何配置我们的入口点,以便我们可以从子文件夹中导入我们的组件,例如
import { Thing } from "tsdx-styled-components/things"
import { SimpleStyledH1Application } from "tsdx-styled-components/styled"
import { CoreComponent } from "tsdx-styled-components"
Run Code Online (Sandbox Code Playgroud)
关于如何将子文件夹添加到我们创建的库中的指南/注释,这样(不仅对我来说而且对使用 TSDX 的任何人来说)如何创建带有子文件夹的库都很容易。
示例项目:
https://github.com/robertovg/tsdx-styled-components/ https://github.com/robertovg/next-ts-styled-components-tsdx-host
这个问题最初作为tsdx上的问题发布,但几个月后没有答案,我想将其移至此处,看看是否有人解决了该问题。