0

I'm using WebStorm 2021.2.4, and when I create a Vue.js 3 app I have this error:

enter image description here

It looks like the IDE cannot identify @ as the root directory src. How can I solve this?

LazyOne
  • 148,457
  • 42
  • 363
  • 369
Romulus Urakagi Ts'ai
  • 3,469
  • 8
  • 37
  • 65

1 Answers1

1

Vite, as well as vite aliases, is not yet supported. Please feel free to vote for WEB-53634 and linked tickets. Actually we can hardly afford supporting all possible ways to define path mappings coming from different bundlers, frameworks and plugins. In the future we'd likely provide some unified way to deal with them in the IDE. For now, I can only suggest creating a dummy config.js file with all aliases specified explicitly like

module.exports = {
  resolve: {
    alias: {
      '@': path.resolve(__dirname, "src/"] ,
      ...
    },
  },
};

and then set the webpack configuration to Manual in Settings | Languages & Frameworks | JavaScript | Webpack and specify a full path to this dummy config there

lena
  • 80,392
  • 7
  • 128
  • 137
  • I cannot get the workaround working whatever I try. I also don't find any useful hints in the `idea.log`. Oddly enough, `import ... from "@/..." or `"@/..."` in ` – Zulan Apr 10 '22 at 17:54