看起来非常微不足道的问题。我有一个使用 rollup-plugin-typescript 和 rollup-plugin-dts 的汇总打字稿配置。我想将所有 d.ts 文件捆绑到一个 d.ts 文件中,而不是让它镜像我的项目结构。我遵循了一些教程并最终得到了下面的配置。
\n问题: dts() 正确捆绑文件,但保留原始构建结构不变。我的资源都没有解决这个问题。现在已经过时的输入文件不应该被删除吗?我是否对插件处理不当?
\n我从哪里开始:
\ndist/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.js \n\xe2\x94\x9c\xe2\x94\x80 dts //I compile my types into here, below is my mirrored project structure\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 components\n \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Button.d.ts\n \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.d.ts\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.d.ts\nRun Code Online (Sandbox Code Playgroud)\n我想要的是:
\ndist/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.js \n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.d.ts //everything bundled here\nRun Code Online (Sandbox Code Playgroud)\n不幸的是我得到的是:
\ndist/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.js \n\xe2\x94\x9c\xe2\x94\x80 dts //All of this is still here, it shouldn't be\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 components\n \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Button.d.ts\n \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.d.ts\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.d.ts\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.d.ts //It …Run Code Online (Sandbox Code Playgroud) 因此,如果我没有记错的话,基于类的组件和函数式组件都可以使用状态和生命周期方法。并且可以使用钩子使用两个或仅使用功能组件来构建您的应用程序。
我想知道现实世界中是否真的存在最佳实践。在企业环境中通常使用什么方法?对此是否有明确的答案,或者公司是否不断结合所有方法?