Spagheeti
Spagheeti

Reputation: 79

Vue module not found import

So I want to import but it always show Module not found: Error: Can't resolve '/resources/js/services/http/Http' in 'D:\laragon\www\myapp\resources\js\pages\posts' how do I need to import this? Structure: enter image description here

Inside Manage.vue importing like this import { Http } from '/resources/js/services/http/Http';

Upvotes: 1

Views: 806

Answers (1)

Melvin Tehubijuluw
Melvin Tehubijuluw

Reputation: 573

In this case the root folder is the 'js' folder. So you are basically referencing this path: js/resources/js/services/http/Http.js

You should be importing with the base folder ( again 'js') in mind.

import { Http }  from './services/http/Http.js';

In your case you are trying to import your module from inside the pages/posts directory, that is why you should import your module like this:

import { Http }  from '../../services/http/Http.js';

Upvotes: 1

Related Questions