-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Cannot detect @swc-node/register
loaded by fastify-cli
with the -r
option
#404
Comments
@fastify/autoload
cannot detect @swc-node/register
loaded by fastify-cli
with the -r
option@swc-node/register
loaded by fastify-cli
with the -r
option
Is it an autoloader or a fastify-cli related issue? |
I don't think this is If not, maybe |
If no answer from other collaborators, are you willing to investigate and push a PR on the right repo plz? |
Imitating Node.js behavior by adding the following lines in I'll wait for more comments. Object.defineProperty(process, '_preload_modules', {
__proto__: null,
writable: false,
configurable: true,
enumerable: true,
value: opts.require,
}) |
Wdyt @mcollina? I still think this issue should be transfered to
Or we can also document this workaround here. |
I think the problem is in this repo, we should not be checking that. Maybe we should check the require cache as well. |
Looking into it |
Now I believe we should solve it in |
Prerequisites
Fastify version
4.28.1
Plugin version
5.10.0
Node.js version
20.x
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
10
Description
I'm using
fastify start -r @swc-node/register app.ts
to start my app written in TypeScript.However, this plugin cannot detect
@swc-node/register
loaded byfastify-cli
and the following error is thrown:Related PR:
PR #191 fixed the case with
node -r @swc-node/register
but not withfastify start -r @swc-node/register
.Current workaround:
I have to manually set the
FASTIFY_AUTOLOAD_TYPESCRIPT
environment variable.Additional information:
The current
checkPreloadModules()
util checks theprocess._preload_modules
array, but it's empty when the package is required withfastify-cli
.Link to code that reproduces the bug
https://github.com/zetaraku/fastify-app
Expected Behavior
The plugin should be able to detect the
@swc-node/register
package loaded byfastify start -r @swc-node/register
.The text was updated successfully, but these errors were encountered: