fastify / fastify-vite

Fastify plugin for Vite integration.
MIT License
826 stars 67 forks source link

Route path resolution of starters/react-base not working in Windows #150

Open rondonjon opened 3 months ago

rondonjon commented 3 months ago

Prerequisites

Fastify version

4.26.2

Plugin version

0.6.0

Node.js version

21.7.1

Operating system

Windows

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

11

Description

dev script fails in Windows and shows:

09:11:01 [vite] Pre-transform error: Failed to load url ./Users/.../fastify-vite/starters/react-base/C:/Users/.../fastify-vite/starters/react-base/client/pages/index.jsx (resolved id: ./Users/.../fastify-vite/starters/react-base/C:/Users/.../fastify-vite/starters/react-base/client/pages/index.jsx) in /:routes.js. Does the file exist?
09:11:01 [vite] Error when evaluating SSR module /:routes.js: failed to import "./Users/.../fastify-vite/starters/react-base/C:/Users/.../fastify-vite/starters/react-base/client/pages/index.jsx"
|- Error: Failed to load url ./Users/.../fastify-vite/starters/react-base/C:/Users/.../fastify-vite/starters/react-base/client/pages/index.jsx (resolved id: ./Users/.../fastify-vite/starters/react-base/C:/Users/.../fastify-vite/starters/react-base/client/pages/index.jsx) in /:routes.js. Does the file exist?
    at loadAndTransform (file:///C:/Users/.../fastify-vite/starters/react-base/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:53848:21)
    at async instantiateModule (file:///C:/Users/.../fastify-vite/starters/react-base/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:54902:10)

09:11:01 [vite] Error when evaluating SSR module C:\Users\se\Documents\vscode\fastify-vite\starters\react-base\client\index.js: failed to import "/:routes.js"
|- Error: Failed to load url ./Users/.../fastify-vite/starters/react-base/C:/Users/.../fastify-vite/starters/react-base/client/pages/index.jsx (resolved id: ./Users/.../fastify-vite/starters/react-base/C:/Users/.../fastify-vite/starters/react-base/client/pages/index.jsx) in /:routes.js. Does the file exist?
    at loadAndTransform (file:///C:/Users/.../fastify-vite/starters/react-base/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:53848:21)
    at async instantiateModule (file:///C:/Users/.../fastify-vite/starters/react-base/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:54902:10)

node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^

Error: Failed to load url ./Users/.../fastify-vite/starters/react-base/C:/Users/.../fastify-vite/starters/react-base/client/pages/index.jsx (resolved id: ./Users/.../fastify-vite/starters/react-base/C:/Users/.../fastify-vite/starters/react-base/client/pages/index.jsx) in /:routes.js. Does the file exist? 
    at loadAndTransform (file:///C:/Users/.../fastify-vite/starters/react-base/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:53848:21)
    at async instantiateModule (file:///C:/Users/.../fastify-vite/starters/react-base/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:54902:10) {
  code: 'ERR_LOAD_URL'
}

Node.js v21.7.1

Could this be related to https://github.com/fastify/fastify-vite/issues/144 and https://github.com/fastify/fastify-vite/pull/141 ?

Steps to Reproduce

Expected Behavior

Should resolve route paths

code-raisan commented 3 weeks ago

I am the same. Windows does not allow : in the file path!