# low-code-moten **Repository Path**: lyvvq9296/low-code-moten ## Basic Information - **Project Name**: low-code-moten - **Description**: Vue 低代码 monorepo - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-18 - **Last Updated**: 2025-12-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # moten 一个通过 `monorepo` 管理的低代码平台项目, 兼容 `Vue2 & Vue3` 两个版本 ## 项目组成部分 - moten - packages - moten-playground - vue2 - vue3 - moten-ui ### moten-ui `ui` 组件库, 通过 `vue-demi` 依赖兼容 `Vue2 & Vue3` 具体配置: - 依赖配置 ```json // package.json "dependencies": { "vue-demi": "^0.14.10", "vue2": "npm:vue@~2.6.14", "vue2.7": "npm:vue@~2.7.16", "vue3": "npm:vue@~3" }, "peerDependencies": { "@vue/composition-api": "^1.7.2", "vue": "^2.0.0 || >=3.0.0" }, "peerDependenciesMeta": { "@vue/composition-api": { "optional": true } } ``` - 打包配置 ```ts // vite.config.ts; import { isVue2 } from 'vue-demi'; const version = isVue2 ? 'vue2' : 'vue3'; export default defineConfig({ plugins: [isVue2 ? createVuePlugin() : vue()], build: { outDir: `dist/${version}`, lib: { entry: path.resolve(__dirname, 'src/main.ts'), name: 'moten', fileName: 'moten', }, rolldownOptions: { external: ['vue', 'vue-demi'], output: { globals: { vue: 'Vue', 'vue-demi': 'VueDemi', }, }, }, }, }); ``` 这样配置后会出现依赖混乱的问题 原因是 `vue-template-compiler@2.7.16` 里面依赖了 `vue3` 导致版本不兼容 ``` error during build: Error: Vue packages version mismatch: - vue@3.5.24 (/Users/liyongwei/disk/L-yw/study/Vue/low-code-moten/node_modules/.pnpm/vue@3.5.24_typescript@5.9.3/node_modules/vue/index.js) - vue-template-compiler@2.7.16 (/Users/liyongwei/disk/L-yw/study/Vue/low-code-moten/node_modules/.pnpm/vue-template-compiler@2.7.16/node_modules/vue-template-compiler/package.json) This may cause things to work incorrectly. Make sure to use the same version for both. If you are using vue-loader@>=10.0, simply update vue-template-compiler. If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest. ``` 需要在根路径的`package.json`配置 ```json // package.json "packageExtensions": { "vue-template-compiler": { "dependencies": { "vue": "^2.7.16" } }, "vue-template-compiler@2.7.16": { "dependencies": { "vue": "^2.7.16" } } } ``` ### moten-playground `moten-ui` 组件预览 #### vue2 `moten-ui` 组件 `Vue2` 版本预览 #### vue3 `moten-ui` 组件 `Vue3` 版本预览