Vite+Vue3+Antdv 4, all antdv4 component styles could not display on Safari 12 #6739
Unanswered
leeskyler-top
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I use npm to built the src, all antdv4 component styles could not display on Safari 12.
This is my vite.config.js:
`
import {fileURLToPath, URL} from 'node:url'
import legacy from '@vitejs/plugin-legacy'
import PostCssPresetEnv from 'postcss-preset-env';
import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import autoprefixer from "autoprefixer";
// import Components from 'unplugin-vue-components/vite';
// import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
legacy({
targets: [
"> 0.5%, last 1 version, ie >= 11",
"safari >= 13",
// "Android > 39",
// "Chrome >= 60",
// "Safari >= 10.1",
"iOS > 13",
// "Firefox >= 54",
// "Edge >= 15"
],
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
polyfills: ["es.promise.finally", "es/map", "es/set"],
// modernPolyfills: ["es.promise.finally"]
modernPolyfills: true,
}),
// Components({
// resolvers: [AntDesignVueResolver()],
// }),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
//TODO 设置资源根路径,默认为 '/' 导致只能在根目录下访问。 修改为 './' 即可访问相对路径。
base: './',
build: {
cssCodeSplit: true,
terserOptions: {
compress: {
keep_infinity: true,
drop_console: true,
},
},
rollupOptions: {
plugins: [],
},
target: "es2015"
},
css: {
postcss: {
plugins: [PostCssPresetEnv(),autoprefixer()],
},
},
})
`
Normal Effect:

Safari12:

Beta Was this translation helpful? Give feedback.
All reactions