1 Star 0 Fork 0

乐清 / MeClan

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vite.config.js 2.80 KB
一键复制 编辑 原始数据 按行查看 历史
乐清 提交于 2022-02-09 20:29 . commit
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
/*
路径别名
若为文件系统路径必须是绝对路径的形式,否则将以别名原样呈现,不会解析为文件系统路径路径
*/
//'@': process.cwd()+'/src'
//'@':path.resolve('src')
//'@':path.resolve(__dirname, 'src')
'@': path.resolve(__dirname, './src')
},
},
plugins: [vue()],
/*
Project root directory/项目根目录(index.html所在位置),可以是绝对路径,也可以是相对于本配置文件的路径。
default:process.cwd() 返回 Node.js 进程的当前工作目录
*/
//root:process.cwd(),
/*
Default: /
Base public path (应用基础请求路径) when served in development or production. Valid values include:
Absolute URL pathname, e.g. /foo/
Full URL, e.g. https://foo.com/
Empty string or ./ (for embedded deployment)
*/
// base: '/admin/',
/*
Directory to serve as plain static assets.
Files in this directory are served at / during dev and copied to the root of outDir during build, and are always served or copied as-is without transform.
The value can be either an absolute file system path or a path relative to project root.
静态资源目录,开发模式下会自动放到 / 下,生产模式下会自动放到 outDir 根路径下。
该目录可以配置为文件系统绝对目录或者相对于项目根目录的相对路径
*/
publicDir:'public',
/*
Default: 'development' for serve, 'production' for build
Specifying this in config will override the default mode for both serve and build. This value can also be overridden via the command line --mode option.
*/
//mode:'',
//vite开发服务器配置
server: {
host: 'localhost',
port: 8080,
open: true,
strictPort: false,
https: false,
// 反向代理
// proxy: {
// '/admin': {
// target: 'http://api.vite-admin.com',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/admin/, '')
// },
// }
//proxy: {
// // string shorthand
// '/foo': 'http://localhost:4567/foo',
// // with options
// '/api': {
// target: 'http://jsonplaceholder.typicode.com',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// },
// // with RegEx
// '^/fallback/.*': {
// target: 'http://jsonplaceholder.typicode.com',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/fallback/, '')
// }
// }
},
//生产模式打包配置
build:{
outDir: 'dist',//Specify the output directory (relative to project root).
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/illusoryNone/me-clan.git
git@gitee.com:illusoryNone/me-clan.git
illusoryNone
me-clan
MeClan
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891