Files
Enterprise-Knowledge-Base/frontend/vite.config.ts
T
wizardchen 7b7017ec03 feat: update Vite configuration for module resolution
- Replaced direct import of '@vue-office/pptx' with require.resolve to improve module resolution in the Vite configuration.
- Added createRequire to support CommonJS-style imports in the ES module context.

This update enhances compatibility and ensures correct module resolution during the build process.
2026-03-02 21:21:49 +08:00

38 lines
850 B
TypeScript

import { fileURLToPath, URL } from 'node:url'
import { createRequire } from 'node:module'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
const require = createRequire(import.meta.url)
export default defineConfig({
plugins: [
vue(),
vueJsx(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@vue-office/pptx': require.resolve('@vue-office/pptx/lib/index.js'),
},
},
server: {
port: 5173,
host: true,
// 代理配置,用于开发环境
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false,
},
'/files': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false,
}
}
}
})