惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
Lohrmann on Cybersecurity
S
Secure Thoughts
I
Intezer
Forbes - Security
Forbes - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
H
Help Net Security
IT之家
IT之家
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
宝玉的分享
宝玉的分享
S
Securelist
T
The Exploit Database - CXSecurity.com
博客园 - 叶小钗
Security Latest
Security Latest
The Cloudflare Blog
Jina AI
Jina AI
T
Tenable Blog
J
Java Code Geeks
G
GRAHAM CLULEY
C
CERT Recently Published Vulnerability Notes
SecWiki News
SecWiki News
AI
AI
博客园 - 聂微东
S
Schneier on Security
博客园_首页
爱范儿
爱范儿
有赞技术团队
有赞技术团队
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 【当耐特】
T
Threatpost
Security Archives - TechRepublic
Security Archives - TechRepublic
Help Net Security
Help Net Security
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
W
WeLiveSecurity
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
S
Security Affairs
T
Tor Project blog
T
Tailwind CSS Blog
N
News | PayPal Newsroom
C
CXSECURITY Database RSS Feed - CXSecurity.com
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
The Register - Security
The Register - Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security

Lan小站-嗯,不错! - 转载文章

Chrome:此扩展程序不再受支持,因此已停用,Mac解决方案 - Lan小站-嗯,不错! 哈夫曼树(最优二叉树)的概念以及构造 - Lan小站-嗯,不错! 利用js去除无限debugger - Lan小站-嗯,不错! 在pycharm中为函数或方法以及参数添加注释 - Lan小站-嗯,不错! 关于Python的面试题 - Lan小站-嗯,不错! Python面试宝典-基础篇-2020 - Lan小站-嗯,不错! 数据库事务的概念及其实现原理 - Lan小站-嗯,不错! 论文格式 - Lan小站-嗯,不错! python PIL/cv2/base64相互转换 - Lan小站-嗯,不错!
vite2.1 最新alias别名设置方式 - Lan小站-嗯,不错!
Lan · 2021-08-28 · via Lan小站-嗯,不错! - 转载文章

Lan

本文最后更新于2021年08月28日,已超过1751天没有更新,若内容或图片失效,请留言反馈。

vite.config.js 别名配置

resolve.alias
类型: Record<string, string> | Array<{ find: string | RegExp, replacement: string }>

将会被传递到 @rollup/plugin-alias 作为 entries 的选项。也可以是一个对象,或一个 { find, replacement } 的数组.

当使用文件系统路径的别名时,请始终使用绝对路径。相对路径的别名值会被原封不动地使用,因此无法被正常解析。

更高级的自定义解析方法可以通过 插件 实现。

import {
  defineConfig
} from 'vite'
import path from "path";
import vue from '@vitejs/plugin-vue'
 
 
// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
      "components": path.resolve(__dirname, "src/components"),
      "styles": path.resolve(__dirname, "src/styles"),
      "plugins": path.resolve(__dirname, "src/plugins"),
      "views": path.resolve(__dirname, "src/views"),
      "layouts": path.resolve(__dirname, "src/layouts"),
      "utils": path.resolve(__dirname, "src/utils"),
      "apis": path.resolve(__dirname, "src/apis"),
      "dirs": path.resolve(__dirname, "src/directives"),
    },
  },
  plugins: [vue()],
});

或者 数组的形式

 
import {
  defineConfig
} from 'vite'
import path from "path";
import vue from '@vitejs/plugin-vue'
 
 
// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: [{
        find: '@',
        replacement: path.resolve(__dirname, 'src')
      },
      {
        find: 'components',
        replacement: path.resolve(__dirname, 'src/components')
      }
    ],
  },
  plugins: [vue()],
});

注意要导入path啊,还有vite.config配置要关项目重启
1
————————————————
版权声明:本文为CSDN博主「yusirxiaer」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yusirxiaer/article/details/115440738