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

mts file extension is not supported for vite.config #142

Open
2 tasks done
edwardbrowncross opened this issue Mar 6, 2024 · 3 comments
Open
2 tasks done

mts file extension is not supported for vite.config #142

edwardbrowncross opened this issue Mar 6, 2024 · 3 comments

Comments

@edwardbrowncross
Copy link

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.0

Plugin version

6.0.5

Node.js version

18.19.0

Operating system

Linux

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

20.04

Description

If the vite.config file has a mts file extension (vite.config.mts), which is a file extension Vite suggests in its documentation, calling server.vite.ready() throws an error similar to the following:

node_modules/@fastify/vite/config.js:245
    bundle.dir = resolve(vite.root, vite.build.outDir)
                              ^

TypeError: Cannot read properties of null (reading 'root')

This is as a result of 'mts' not appearing in this array:
https://github.com/fastify/fastify-vite/blob/dev/packages/fastify-vite/config.js#L200

Steps to Reproduce

Change the file extension of your vite.config file to .mts

Expected Behavior

I expect the Vite config file to be detected, as Vite itself can detect it.

@galvez
Copy link
Member

galvez commented Mar 6, 2024

Good catch, will release a patch later today after work.

@favna
Copy link

favna commented Mar 18, 2024

@galvez Any updates on this? I had to change my vitest config from .ts to .mjs in lieue of this issue being resolved.

@galvez
Copy link
Member

galvez commented Mar 18, 2024

Hey — I'll find some time tonight to get this sorted out and push a new release.

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