# monorepo
**Repository Path**: YanJingShe/monorepo
## Basic Information
- **Project Name**: monorepo
- **Description**: No description available
- **Primary Language**: JavaScript
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-09-16
- **Last Updated**: 2025-09-16
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
引入css样式方法一
在子项目的package.json中配置"@common/css": "file:../../../packages/common/index.css",在项目的根目录的执行pnpm install命令,安装依赖。
在main.ts中引入"@common/css/index.css"即可:@common/css:包名称后面跟的是包路径
--------------------------------------------分割线--------------------------------------------------
引入css样式方法二
到子项目目录下
执行:pnpm add @ui/components@workspace:* 将@ui/components包共享给子项目
在子项目的package.json中配置"@common/css": "file:../../../packages/common/index.css",在项目的根目录的执行pnpm install命令,安装依赖。
在main.ts中引入"@common/css/index.css"即可:@common/css:包名称后面跟的是包路径
--------------------------------------------分割线------------------------------------------------------
引入组件方法一
vite.config.ts
import { fileURLToPath, URL } from 'url'
resolve: {
alias:{
'@AButton': fileURLToPath(new URL('../../packages/ui-components', import.meta.url)),
'@AText': fileURLToPath(new URL('../../packages/ui-components', import.meta.url)),
'utilsjs': fileURLToPath(new URL('../../packages/libs-shared', import.meta.url))
}
},
页面引入:
import AButton from "@AButton/AButton/AButton.vue";
import AText from "@AText/AText/AText.vue";
-------------------------------------------------分割线--------------------------------------------
引入组件方法二
到子项目目录下
执行:pnpm add @ui/components@workspace:* 将@ui/components包共享给子项目
页面引入:页面引入路径@ui/components包名称,后面是组件路径
import AButton from "@ui/components/AButton/AButton.vue"
-------------------------------------------------引入js模块------------------------------------------
执行:pnpm add @libs/shared@workspace:* 将@libs/shared包共享给子项目
页面引入:页面引入路径@libs/shared包名称,后面是模块路径
import { consoleLog } from "@libs/shared/utils/base.js";
consoleLog()