You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

86 lines
2.6 KiB

// Plugins
import vue from '@vitejs/plugin-vue'
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// Utilities
import { defineConfig } from 'vite'
import { fileURLToPath, URL } from 'node:url'
// https://vitejs.dev/config/
export default defineConfig({
build: {
rollupOptions: {
output: {
chunkFileNames: 'js/[name]-[hash].js', // 引入文件名的名称
entryFileNames: 'js/[name]-[hash].js', // 包的入口文件名称
// assetFileNames: '[ext]/[name].[ext]', // 资源文件像 字体,图片等
// chunkFileNames: 'js/[name]-[hash].js', // 引入文件名的名称
// entryFileNames: 'js/[name]-[hash].js', // 包的入口文件名称
// assetFileNames: '[ext]/[name]-[hash].[ext]', // 资源文件像 字体,图片等
manualChunks(id) {
// if (id.includes("node_modules")) {
// return "vendor" //代码分割为第三方包
// }
// if (id.includes("src")) {
// return "views" //代码分割为业务视图
// }
if (id.includes("sfykf")) {
return "sfykf" //代码分割为common页面登录页
}
}
}
},
// lib: {
// entry: resolve(__dirname, './src/main.js'), // 设置入口文件【这里也可以直接引用插件.vue根组件】
// name: 'helloword', // 起个名字,安装、引入用
// fileName: (format) => `helloword.${format}.js`, // 打包后的文件名【可以自定义】
// formats: ['umd']
// },
cssCodeSplit: false,
// jsCodeSplit: false,
chunkSizeWarningLimit: 512
},
plugins: [
vue({
template: { transformAssetUrls }
}),
// https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vite-plugin
vuetify({
autoImport: true,
}),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
],
define: { 'process.env': {} },
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
extensions: [
'.js',
'.json',
'.jsx',
'.mjs',
'.ts',
'.tsx',
'.vue',
],
},
server: {
port: 3000,
// proxy: {
// "/biobank": {
// target: "http://114.132.224.5:7001/biobank",
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/biobank/, ""),
// },
// },
},
})