【发布时间】:2020-02-20 19:52:33
【问题描述】:
您好,我目前正在 react 中的 monorepo 应用程序中工作。
我需要提取它的一些“组件”和“样式”并创建位于主项目之外的单独模块/包,然后像普通模块一样将它们导入package.json。
初始文件结构和未来提案结构:
myMainproject:
\src
\components
component-styles.scss
\button
\label
\list
\item
.......
\modules
\calendar
\header
\footer
\support
.....
package.json
....
// I extract calendar, footer modules
calendarService:
\src
\components
component-styles.scss
\button
\label
\list
\item
.......
\modules
\calendar
.....
package.json
....
footerService:
\src
\components
component-styles.scss
\button
\label
\list
\item
.......
\modules
\footer
.....
package.json
....
// Extract style and create a separate service
styleService
\src
\styles
.....
package.json
....
final 'package.json' of 'myMainproject':
......
"dependencies": {
"calendarService": ...,
"footerService": .... ,
"styleService": ...,
.....
}
您是否有任何想法,不仅是技术上的,还有架构上的,或者有任何文档来实现这一点?
【问题讨论】:
-
并非如此。我刚开始。我愿意接受建议。你用 lerna 做到了吗?
标签: javascript html css reactjs redux