// vite.config.playground.ts import react from '@vitejs/plugin-react'; import postcssUrl from 'postcss-url'; import { defineConfig } from 'vite'; import { viteStaticCopy } from 'vite-plugin-static-copy'; export default defineConfig({ plugins: [ react(), viteStaticCopy({ targets: [{ src: 'src/assets/fonts', dest: 'assets', }], }), ], base: './', build: { outDir: 'dist-web', // 输出目录 }, server: { host: '0.0.0.0', port: 5173, }, css: { postcss: { plugins: [ postcssUrl({ url: (asset) => { if (!/\.(woff|woff2|ttf)$/.test(asset.pathname || '')) { return asset.url; } // ensure paths are correct in npm publish return `"../assets/fonts/${asset.url.split('/').pop()}"`; }, }), ], }, preprocessorOptions: { scss: { api: 'modern-compiler', additionalData: ` @use "@tencentcloud/uikit-base-component-react/dist/styles/theme/util" as *; `, }, }, }, });