Revert "fix(vite.config.json): path导入编译器提示错误问题修复"
This reverts commit 56b9a6c5
This commit is contained in:
@@ -2,9 +2,9 @@ import {UserConfig, ConfigEnv, loadEnv} from 'vite'
|
|||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import viteSvgIcons from 'vite-plugin-svg-icons';
|
import viteSvgIcons from 'vite-plugin-svg-icons';
|
||||||
// 如果编辑器提示 path 模块找不到,则可以安装一下 @types/node -> npm i @types/node -D
|
// 如果编辑器提示 path 模块找不到,则可以安装一下 @types/node -> npm i @types/node -D
|
||||||
import * as path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
// vite2明细配置参考: https://gitee.com/holysheng/vite2-config-description/blob/master/vite.config.ts
|
// @see: https://gitee.com/holysheng/vite2-config-description/blob/master/vite.config.ts
|
||||||
|
|
||||||
export default ({command, mode}: ConfigEnv): UserConfig => {
|
export default ({command, mode}: ConfigEnv): UserConfig => {
|
||||||
// 获取 .env 环境配置文件
|
// 获取 .env 环境配置文件
|
||||||
@@ -37,10 +37,45 @@ export default ({command, mode}: ConfigEnv): UserConfig => {
|
|||||||
},
|
},
|
||||||
|
|
||||||
resolve: {
|
resolve: {
|
||||||
// 相对路径别名配置,@表示src
|
// Vite2设置别名路径方式一
|
||||||
alias: {
|
alias: {
|
||||||
"@": path.resolve("./src"),
|
"@": path.resolve("./src"), // 相对路径别名配置,@表示src
|
||||||
}
|
},
|
||||||
|
// Vite2设置别名路径方式二
|
||||||
|
// alias: [
|
||||||
|
// {
|
||||||
|
// find: "@",
|
||||||
|
// replacement: path.resolve("./src")
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// find: "@image",
|
||||||
|
// replacement: path.resolve("./src/assets/images")
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// find: "@/router",
|
||||||
|
// replacement: path.resolve("./src/router")
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// find: "@/store",
|
||||||
|
// replacement: path.resolve("./src/store")
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// find: "@/api",
|
||||||
|
// replacement: path.resolve("./src/api")
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// find: "@/utils",
|
||||||
|
// replacement: path.resolve("./src/utils")
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// find: "@/views",
|
||||||
|
// replacement: path.resolve("./src/views")
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// find: "@/styles",
|
||||||
|
// replacement: path.resolve("./src/styles")
|
||||||
|
// },
|
||||||
|
// ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user