Webpack: Module not found: Error: Can't resolve '@/components/Hello'

Created on 15 Aug 2017  路  4Comments  路  Source: vuejs-templates/webpack

I created a new project using this template. Made default selection for every option that vue init asked. Then I ran the following commands

cd <project-dir>
npm install
vuew build src/main.js --prod

The last command gives an error that coponent @/components/Hello cannot be resolved.

I have not changed anything in the project yet.

However, if I run npm run dev everything just works fine.

All 4 comments

What is vuew build?

That's not a functionality of this template

Ah, I think you try and owe vue-cli build?

Nope. Thartemplate has its own build command, have a look in package.json

I have the same error when I deploy it on netlify, "@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!" What I understand is when im in prod env the alias doenst work well.. Is there an option I can add ? Also, when I run in my terminal, yarn run build, it work fine without all thoses errors.. Ive setup my own NODE_VERSION, YARN_VERSION to match the version I got on my machine..

Please use our forums (forum.vuejs.org) for support a questions, or open a proper bug report issue with a reproduction.

Was this page helpful?
0 / 5 - 0 ratings