Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

error: No loader is configured for ".vue" files: components/ComponentName.vue #18

Closed
jericopulvera opened this issue Feb 26, 2021 · 10 comments

Comments

@jericopulvera
Copy link

tried it just now with my SPA project.

@maddocnc
Copy link

Same here:

html:/Users/user/Projects/big-vue/pages/news/_id.vue:6:28: error: No loader is configured for ".vue" files: components/v3/v3-promo.vue
6 │ v3Promo: () => import('@/components/v3/v3-promo'),
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~

@heyarviind
Copy link

I am having the same issue with layouts...

@pierredup
Copy link

Vue files need to be imported with the .vue extension. Without the extension, it won't work. E.G

// before
import MyButton from '@/components/util/my-button';

// after
import MyButton from '@/components/util/my-button.vue';

@heyarviind
Copy link

@pierredup it worked

@jericopulvera
Copy link
Author

Worked for me as well.

Here's a shortcut that worked for me if you have many lines without .vue

Step 1: Add .vue at the end of lines that contains @/components using search in regex mode.

Type in Regex Search

^.*(@/components).*$

Replace with

$0.vue

Execute Replace All

Step 2: Search and Replace ";.vue to .vue";

@FelixGraf
Copy link

Not sure if this issue should be closed. I think it would be cool, if it would work out of the box - without having to add .vue extension to every import.

@jericopulvera
Copy link
Author

Not sure if this issue should be closed. I think it would be cool, if it would work out of the box - without having to add .vue extension to every import.

You've got a point. I'll reopen this and wait for the maintainers decision.

@jericopulvera jericopulvera reopened this Feb 26, 2021
@pierredup
Copy link

I think it would be cool, if it would work out of the box - without having to add .vue extension to every import

This is not an issue with this plugin but is by design how Vite works.

See vitejs/vite#178 (comment) and https://twitter.com/youyuxi/status/1288859415878283264

@FelixGraf
Copy link

This is not an issue with this plugin but is by design how Vite works.

Good to know, thanks!

@jericopulvera
Copy link
Author

I will close this now as it has nothing to do with the plugin.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants