[Vuejs]-Can vue import path be specified to have multiple starting point?

0👍

You can make an alias for "src" fodler and then your import paths will look like this:

import {b} from '@/c/d'

If you use Vite, the alias is already defined by default. You can find it in vite.config

export default defineConfig({
  plugins: [vue(), vueJsx()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)) // this is an alias
    }
  }
})

Please provide information which version of Vue do you use. And do you use Vite or something else?

0👍

It seems if I use the same yarn.lock for exactly the same package version and then use the same vue.config.js file, the issue is gone. It may be related to package version. I saw the working vue version is 2.6.12.

Leave a comment