Skip to content

Unable to override vite.build.outDir #158

Open
@AnzeKop

Description

@AnzeKop

Prerequisites

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

Fastify version

Latest

Plugin version

Latest

Node.js version

20

Operating system

macOS

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

Sonoma

Description

I use a src/dist build approach and want my files to live in src/routes/client. It works fine in development and I can build it however needed but as the outDir is not configurable it fails when starting due to this if statement in production.js

` const clientDist = config.spa
? resolve(config.bundle.dir)
: resolve(config.bundle.dir, 'client')

if (!exists(clientDist)) {
throw new Error('No client distribution bundle found.')
}

const serverDist = resolve(config.bundle.dir, 'server')
if (!config.spa && !exists(serverDist)) {
throw new Error('No server distribution bundle found.')
}`

When I try setting the resolve to resolve(config.bundle.dir) for both the server and the client dist it passes this but then somehow finds a duplicate in the root path in the fastify static plugin

rootPath [ '/dist/client/assets', '/dist/client/assets' ]

Its extremly difficult to make this plugin work with anything else working along side it. Fastify autoload is also almost impossible to configure with Vite.

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