代码拉取完成,页面将自动刷新
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import legacy from '@vitejs/plugin-legacy'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { VantResolver } from '@vant/auto-import-resolver'
import { svgToVue } from './plugins'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = { ...process.env, ...loadEnv(mode, process.cwd()) }
return {
plugins: [
vue(),
legacy({
targets: ['defaults', 'not IE 11']
}),
svgToVue({ includes: ['./src/assets/images/icons'] }),
AutoImport({
resolvers: [VantResolver()],
imports: ['vue', 'vue-router'],
dirs: ['/src/hooks'],
dts: './auto-import.d.ts',
eslintrc: {
enabled: true
}
}),
Components({
resolvers: [VantResolver()],
dts: true,
extensions: ['vue'],
dirs: ['src/components']
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "./src/styles/index.scss";`
}
}
},
base: env.VITE_APP_CDN_URL,
server: {
host: '0.0.0.0',
port: 8142
},
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
return 'vender'
}
}
}
}
}
}
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。