Skip to content

Serving static files on Windows is broken #189

Open
@gao-jing-xin

Description

@gao-jing-xin

Prerequisites

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

Fastify version

5.1.0

Plugin version

7.0.1

Node.js version

22.x

Operating system

Windows

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

win11

Description

Use io path join method to join a url path for url path prefix (@fastify\vite\mode\production.js:50) to serve static files in the production mode in windows OS.

It leads to error in prefix url path just like "\asserts" and causes assert(path[0] === '/' || path[0] === '*', 'The first character of a path should be /or*') (find-my-way\index.js:108) to throw an Exception.

It should be changed to prefix: url.resolve(config.vite.base || '/', assetsDir), (@fastify\vite\mode\production.js:50)

Link to code that reproduces the bug

No response

Expected Behavior

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions