1

I am curious, what is the '@' for in 'npm install -g @vue/cli'

Why don't they just have it as 'vue/cli' instead of '@vue/cli'?

jhaubrich.com
  • 79
  • 2
  • 10

1 Answers1

1

This is done to resolve the package better. For example, with Webpack resolve.alias configuration option (isn't specific to Vue).

In Vue Webpack template, Webpack is configured to replace @/ with src path:

  const path = require('path');

  ...
  resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      ...
      '@': path.resolve('src'),
    }
  },
  ...

The alias could then be used as:

import '@/<path inside src folder>';
Winfried
  • 9,243
  • 4
  • 26
  • 24