Search code examples
node.jsvue.jsvue-cli-3

Why cloned project created with vue-cli-3 doesn't recognise '@' as path?


So, I am in the situation where I created a new Vue project with vue-cli-3. I have worked on it for several weeks.

I have decided to switch to my laptop from desktop as I will be travelling. So I pushed to repo on my desktop and now on my laptop I did git clone the project and used npm install.

Now, when I run npm serve == vue-cli-service serve I get error message that project doesn't recognise modules starting with @ for example import movements from '@/data/movements'.

I have tried the same process with my work laptop and everything worked fine. Did I miss something during cloning from current repo or what happened? Why is that happening please?

I found that you can use vue.config.js and just rewrite the Webpack config (which helps) but why do I need to rewrite config when working on project from different computer?

This is my .gitignore file, I don't think it blocks any important files.

.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*

Solution

  • Update: There was nothing wrong with '@' but git screwed up my filenames.

    Somehow my cloned project had movements.js with small m even though I have renamed it to capital M Movements.js before committing and pushing.