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.
This commit is contained in:
wizardchen
2026-02-28 16:10:25 +08:00
committed by lyingbug
parent 6d88619869
commit 7b7017ec03
+4 -1
View File
@@ -1,8 +1,11 @@
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url'
import { createRequire } from 'node:module'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx' import vueJsx from '@vitejs/plugin-vue-jsx'
const require = createRequire(import.meta.url)
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
vue(), vue(),
@@ -11,7 +14,7 @@ export default defineConfig({
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)), '@': fileURLToPath(new URL('./src', import.meta.url)),
'@vue-office/pptx': '@vue-office/pptx/lib/index.js', '@vue-office/pptx': require.resolve('@vue-office/pptx/lib/index.js'),
}, },
}, },
server: { server: {