From 32d40e1fa37565cd44315569cb89c7eee3cd0d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BC=96=E7=A0=81=E7=8C=BF?= Date: Fri, 19 Sep 2025 13:12:17 +0800 Subject: [PATCH] =?UTF-8?q?@vitejs/plugin-vue-jsx=20=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=A3=85=E9=A5=B0=E5=99=A8=E8=AF=AD=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E6=89=80=E4=BB=A5=E6=8D=A2=E6=88=90@vitejs/plugin-vue-jsx?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=EF=BC=8C=E4=B8=8D=E9=9C=80=E8=A6=81=E4=BB=BB?= =?UTF-8?q?=E4=BD=95=E9=85=8D=E7=BD=AE=E5=B0=B1=E5=8F=AF=E4=BB=A5=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front-end/main-app/package.json | 8 +-- front-end/main-app/src/app/main.ts | 1 - front-end/main-app/src/app/views/Home.tsx | 2 +- front-end/main-app/vite.config.ts | 79 +++++++++++------------ 4 files changed, 41 insertions(+), 49 deletions(-) diff --git a/front-end/main-app/package.json b/front-end/main-app/package.json index 06c857d..5a9304e 100644 --- a/front-end/main-app/package.json +++ b/front-end/main-app/package.json @@ -3,9 +3,6 @@ "version": "0.0.0", "private": true, "type": "module", - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, "scripts": { "dev": "vite", "dep": "concurrently \"npm run build\" \"npm run preview\"", @@ -20,15 +17,12 @@ "vue-router": "^4.0.6" }, "devDependencies": { - "@abraham/reflection": "^0.13.0", "@originjs/vite-plugin-federation": "^1.4.1", "@types/node": "^24.5.2", "@vue3-oop/plugin-vue-jsx": "^1.5.1", - "injection-js": "^2.5.0", "tslib": "^2.8.1", "typescript": "~5.8.0", "vite": "^7.0.6", - "vite-plugin-vue-devtools": "^8.0.0", - "vue3-oop": "^1.2.1" + "vite-plugin-vue-devtools": "^8.0.0" } } diff --git a/front-end/main-app/src/app/main.ts b/front-end/main-app/src/app/main.ts index cd0d95e..af07f72 100644 --- a/front-end/main-app/src/app/main.ts +++ b/front-end/main-app/src/app/main.ts @@ -1,5 +1,4 @@ // import './assets/main.css' -import '@abraham/reflection' import { createApp } from 'vue' import { createPinia } from 'pinia' import App from './App' diff --git a/front-end/main-app/src/app/views/Home.tsx b/front-end/main-app/src/app/views/Home.tsx index 0879123..f4207a1 100644 --- a/front-end/main-app/src/app/views/Home.tsx +++ b/front-end/main-app/src/app/views/Home.tsx @@ -53,7 +53,7 @@ export default class Home extends Vue { item: (val: ListItemType) =>
  • { val.title }
  • } } - { this.testHtml } + { this.testHtml() } ) } diff --git a/front-end/main-app/vite.config.ts b/front-end/main-app/vite.config.ts index db2e855..29c783c 100644 --- a/front-end/main-app/vite.config.ts +++ b/front-end/main-app/vite.config.ts @@ -1,47 +1,46 @@ -import {fileURLToPath, URL} from 'node:url' +import { fileURLToPath, URL } from 'node:url' -import {defineConfig} from 'vite' +import { defineConfig } from 'vite' import vueJsx from '@vue3-oop/plugin-vue-jsx' - import federation from '@originjs/vite-plugin-federation'; export default defineConfig({ - server: { - port: 1300, - host: '0.0.0.0', - strictPort: true, - }, - plugins: [ - vueJsx(), - federation({ - name: 'mainApp', // 主应用模块名(联邦模块需通过此名引用) - remotes: { // 配置远程联邦模块地址(开发/生产需对应) - product: 'http://localhost:1301/assets/remoteEntry.js', - shared: 'http://localhost:1333/assets/remoteEntry.js' - }, - shared: { - vue: { requiredVersion: '^3.5.18' }, - 'vue-router': { requiredVersion: '^4.0.6' }, - pinia: { requiredVersion: '^3.0.3' } - } - }) - ], - build: { - target: 'esnext', - minify: false, - cssCodeSplit: true, - rollupOptions: { - output: { - minifyInternalExports: false - } - } - }, - resolve: { - alias: { - '@': fileURLToPath(new URL('./src/app/', import.meta.url)), - '@shared': fileURLToPath(new URL('./src/shared/', import.meta.url)), - '@features': fileURLToPath(new URL('./src/features/', import.meta.url)), - '@domains': fileURLToPath(new URL('./src/domains/', import.meta.url)) + server: { + port: 1300, + host: '0.0.0.0', + strictPort: true, + }, + plugins: [ + vueJsx(), + federation({ + name: 'mainApp', // 主应用模块名(联邦模块需通过此名引用) + remotes: { // 配置远程联邦模块地址(开发/生产需对应) + product: 'http://localhost:1301/assets/remoteEntry.js', + shared: 'http://localhost:1333/assets/remoteEntry.js' + }, + shared: { + vue: { requiredVersion: '^3.5.18' }, + 'vue-router': { requiredVersion: '^4.0.6' }, + pinia: { requiredVersion: '^3.0.3' } + } + }) + ], + build: { + target: 'esnext', + minify: false, + cssCodeSplit: true, + rollupOptions: { + output: { + minifyInternalExports: false + } + } + }, + resolve: { + alias: { + '@': fileURLToPath(new URL('./src/app/', import.meta.url)), + '@shared': fileURLToPath(new URL('./src/shared/', import.meta.url)), + '@features': fileURLToPath(new URL('./src/features/', import.meta.url)), + '@domains': fileURLToPath(new URL('./src/domains/', import.meta.url)) + }, }, - }, })