Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@fastify/vue Smart Import doesn't resolve path in windows #144

Closed
2 tasks done
agorem opened this issue Mar 10, 2024 · 5 comments
Closed
2 tasks done

@fastify/vue Smart Import doesn't resolve path in windows #144

agorem opened this issue Mar 10, 2024 · 5 comments

Comments

@agorem
Copy link

agorem commented Mar 10, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.26.2

Plugin version

6.0.6

Node.js version

20.10.0

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

11

Description

Hi,

I have downloaded in my Win11 laptop the starter project vue-kitchensink.

After installing the node modules, when I run npm run dev I get loads of errors related with the Smart import URL resolution :

Below you have some examples:

12:54:15 [vite] Pre-transform error: Failed to load url ./$_dev/$_js_projects/vue-kitchensink/C:/$_dev/$_js_projects/vue-kitchensink/client/pages/index.vue (resolved id: ./$_dev/$_js_projects/vue-kitchensink/C:/$_dev/$_js_projects/vue-kitchensink/client/pages/index.vue) in /:routes.js. Does the file exist?
12:54:15 [vite] Pre-transform error: Failed to load url ./$_dev/$_js_projects/vue-kitchensink/C:/$_dev/$_js_projects/vue-kitchensink/client/pages/form/[id].vue (resolved id: ./$_dev/$_js_projects/vue-kitchensink/C:/$_dev/$_js_projects/vue-kitchensink/client/pages/form/[id].vue) in /:routes.js. Does the file exist?
12:54:15 [vite] Pre-transform error: Failed to load url ./$_dev/$_js_projects/vue-kitchensink/C:/$_dev/$_js_projects/vue-kitchensink/client/pages/client-only.vue (resolved id: ./$_dev/$_js_projects/vue-kitchensink/C:/$_dev/$_js_projects/vue-kitchensink/client/pages/client-only.vue) in /:routes.js. Does the file exist?

Any help??

Steps to Reproduce

Just make a fresh starter install and run

Expected Behavior

The resolved ID path in my project should be: C:/$_dev/$_js_projects/vue-kitchensink/client/** and not ./$_dev/$_js_projects/vue-kitchensink/C:/$_dev/$_js_projects/vue-kitchensink/client/*

@agorem
Copy link
Author

agorem commented Mar 13, 2024

Hi,
I think I have located the bug
The problem is in fastify > vue > plugin.cjs globalPattern routing property

The reference to vue pages should be relative and not absolute.

Kind regards...Antonio

@agorem
Copy link
Author

agorem commented Mar 13, 2024

In virtual>layout.vue there is the same problem in the layout pattern:
const appLayouts = import.meta.glob('/layouts/*.vue', { eager: true })

@Shyam-Chen
Copy link
Contributor

Shyam-Chen commented Mar 14, 2024

This is the known issue. (#141)

The issue arises from the injected path:

I'm currently working on developing another version of vite-plugin-vue-routes and vite-plugin-fastify-routes for use with @fastify/vite.

@agorem
Copy link
Author

agorem commented Mar 16, 2024

Thanks @Shyam-Chen,
I'll wait for the update.
Meanwhile, I assume that I can bypass the problem using my own routes,js.

@agorem agorem closed this as completed Mar 16, 2024
@galvez
Copy link
Member

galvez commented Mar 16, 2024

Yes you can!

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

No branches or pull requests

3 participants