增加 cdn 编译后的地址

This commit is contained in:
chenbin 2026-10-16 01:36:52 +08:00
parent 2acc3f568b
commit dd97b96b27

View File

@ -4,30 +4,40 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import vueJsx from '@vitejs/plugin-vue-jsx';
import { babel } from '@rollup/plugin-babel';
import vueJsx from '@vitejs/plugin-vue-jsx'
import { babel } from '@rollup/plugin-babel'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
babel({
plugins: [
[
'@babel/plugin-transform-react-jsx',
{
runtime: 'automatic',
importSource: '@antv/f2',
},
export default defineConfig(({ command }) => {
// 生产构建时指向 CDN 地址,开发时保持 '/'
const base = command === 'build'
? 'https://images.health.ufutx.com/uftx_case'
: '/'
console.log('base', base)
return {
base,
plugins: [
vue(),
vueDevTools(),
babel({
plugins: [
[
'@babel/plugin-transform-react-jsx',
{
runtime: 'automatic',
importSource: '@antv/f2',
},
],
],
],
}),
vueJsx(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
}),
vueJsx(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
},
})
}
})