Vite @ alias path All In One
Vite @ alias path All In One
error
@
alias path
solution
// vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
const path = require('path')
// https://vitejs.dev/config/
export default defineConfig({
resolve:{
alias:{
'@' : path.resolve(__dirname, './src')
},
},
plugins: [vue()]
})
https://vueschool.io/articles/vuejs-tutorials/import-aliases-in-vite/
https://stackoverflow.com/questions/66043612/vue3-vite-project-alias-src-to-not-working
https://vitejs.dev/config/#resolve-alias
demo
{{store.msg}}
{{store.getMsg}}
? {{store.msg}}
{{ this will not be compiled }}? {{store.msg}}
refs
?xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有??xgqfrms, 禁止转载 ???,侵权必究??!