Reputation: 94
I'm trying to add a dependency in a Vue.js Component's script tag.
import AuthenticationService from '@/services/AuthenticationService.js'
The error I get is -
This dependency was not found:
* @services/Api in ./src/services/AuthenticationService.js
To install it, you can run: npm install --save @services/Api
My path structure is client->src->services.
My AuthenticationService.js file
import Api from '@services/Api'
export default {
register(credentials) {
return Api.post()('register', credentials)
}
}
Upvotes: 1
Views: 572
Reputation: 8756
You should use @/services/Api
(see the /
?) in the AuthenticationService
. Otherwise the bundler assumes that @services/x
is an installed package in node_modules
(and obviously isn't able to find it).
Upvotes: 1