fastify / fastify-vite

Fastify plugin for Vite integration.
MIT License
849 stars 71 forks source link

Unable to build project and missing files #151

Open akama-aka opened 4 months ago

akama-aka commented 4 months ago

Prerequisites

Fastify version

^4.24.3

Plugin version

^6.0.3

Node.js version

21.6.1

Operating system

Windows

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

22H2 19045.4291

Description

Hello, I wanted to try Fastify with vue.js out but I directly came into issues. I followed the instructions on the Guide Page npm install giget giget gh:fastify/fastify-vite/starters/vue-base#dev your-app npm i

Everything was fine until now. Now if I type npm run build I get the following issues:

└─Δ npm run build                                                               

> build                                       
> npm run build:client && npm run build:server

> build:client
> vite build --outDir dist/client --ssrManifest

vite v5.2.9 building for production...
✓ 16 modules transformed.
error during build:
RollupError: Could not resolve "./Users//OneDrive/Dokumente//C:/Users//OneDrive/Dokumente//client/pa
ges/index.vue" from "../../../../../../:routes.js"
file: /:routes.js
    at getRollupError (file:///C:/Users//OneDrive/Dokumente//node_modules/rollup/dist/es/shared/parseAst.js:392:41)
    at error (file:///C://slush/OneDrive/Dokumente//node_modules/rollup/dist/es/shared/parseAst.js:388:42)
    at ModuleLoader.handleInvalidResolvedId (file:///C:/Users//OneDrive/Dokumente//node_modules/rollup/dist/es/shared/node-entry.js:189
39:24)
    at file:///C:/Users//OneDrive/Dokumente/node_modules/rollup/dist/es/shared/node-entry.js:18899:26

and the thing that is weird too that the files routes.js, create.js and context.js does not exist and in the root.vue I had to remove the / from export { default } from '/:router.vue' to get the router.vue issue away. But there are then still other errors I get:

Error: [vite]: Rollup failed to resolve import ":router.vue" from "C:\Users\\OneDrive\Dokumente\\client\root.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

Steps to Reproduce

npm install -g giget npm install -g vite giget gh:fastify/fastify-vite/starters/vue-base#dev your-app npm i npm run build

Expected Behavior

That it compiles all files into their Directories

voxpelli commented 1 month ago

Also discussed in Discord: https://discord.com/channels/725613461949906985/1268863878209470505

Without any insight into the issue it does look like an issue with using this setup with the Windows file system, a quite classic issue for Node.js projects and not necessarily something that’s supported by all Node.js projects

Can you try it on a nix-style file system? (Using eg GitHub Codespaces, CodeSandbox, Stackblitz or similar)