You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.18.0
Plugin version
5.7.1
Node.js version
18.16.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Arch Linux x86_64 (kernel: 6.3.9-arch1-1)
Description
The "bug" is that, when I'm trying to auto load my routes from my routes folder, it appears that the plugin is not happy with me using top level await in my file.
But I don't get how that is something that the plugin should care much about?
As stated above, I'm trying to load routes from a 'routes' folder. This is because I didn't find much documentation on doing the registering of the routes via something like how Express does it with app.use('/login', loginRoutes).
I'm using tsx to run the app/server. Since I'm using TypeScript for it.
Steps to Reproduce
This will be pseudo code just to show the example:
import{TwitterAPI}from'twitter-api-v2'/// Create a Twitter client...constuser=awaittwitterClient.v2.me();
This is a simple way to mimic it, maybe there is a better way to reproduce it with just importing a simple function that returns a Promise with a type.
It should then give something like this(maybe only with one error in the error array, this is just using what I got):
errors: [
{
detail: undefined,id: '',location: [Object],notes: [],pluginName: '',text: 'Top-level await is currently not supported with the "cjs" output format'
},
{
detail: undefined,id: '',location: [Object],notes: [],pluginName: '',text: 'Top-level await is currently not supported with the "cjs" output format'
}
],
Expected Behavior
I expected it to load the routes and not complain about the file trying to be a .cjs.
The text was updated successfully, but these errors were encountered:
Prerequisites
Fastify version
4.18.0
Plugin version
5.7.1
Node.js version
18.16.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Arch Linux x86_64 (kernel: 6.3.9-arch1-1)
Description
The "bug" is that, when I'm trying to auto load my routes from my routes folder, it appears that the plugin is not happy with me using top level await in my file.
But I don't get how that is something that the plugin should care much about?
As stated above, I'm trying to load routes from a 'routes' folder. This is because I didn't find much documentation on doing the registering of the routes via something like how Express does it with
app.use('/login', loginRoutes)
.I'm using
tsx
to run the app/server. Since I'm using TypeScript for it.Steps to Reproduce
This will be pseudo code just to show the example:
This is a simple way to mimic it, maybe there is a better way to reproduce it with just importing a simple function that returns a Promise with a type.
It should then give something like this(maybe only with one error in the error array, this is just using what I got):
Expected Behavior
I expected it to load the routes and not complain about the file trying to be a
.cjs
.The text was updated successfully, but these errors were encountered: