vue 别名路径智能提示 配置文件

在tsconfig.json 或者jsconfig.json中配置以下内容

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "baseUrl": "./",
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
  },
}

修改后记得重新启动项目

在vite项目中还需要在vite.config.ts或者vite.config.js配置以下代码

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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
  • 2021-11-28
  • 2021-12-25
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案