Skip to content

Conversation

@SimoneDevkt
Copy link
Contributor

@SimoneDevkt SimoneDevkt commented Mar 6, 2025

I modified the app-ts-esm template by inserting the indicated tsconfig
https://nodejs.org/en/learn/typescript/run-natively#running-typescript-code-with-nodejs and erasableSyntaxOnly.
This way the dev script can directly launch the ts file with --experimental-strip-types

Checklist

@mcollina mcollina added the semver-major Issue or PR that should land as semver major label Mar 8, 2025
@mcollina
Copy link
Member

mcollina commented Mar 8, 2025

Once strip types ships in Node v20, I'd recommend shipping a new version of this as a semver-major.

@mcollina
Copy link
Member

mcollina commented Mar 8, 2025

Why is FASTIFY_AUTOLOAD_TYPESCRIPT=1 needed?

@SimoneDevkt
Copy link
Contributor Author

SimoneDevkt commented Mar 8, 2025

Why is FASTIFY_AUTOLOAD_TYPESCRIPT=1 needed?

I tried to run it without this flag, but I got an error. I don't know why

Error: @fastify/autoload cannot import plugin at '***\fastify-cli\test1\src\plugins\sensible.ts'. To fix this error compile TypeScript to JavaScript or use 'ts-node' to run your app.
    at handleTypeScriptSupport (***\fastify-cli\node_modules\@fastify\autoload\lib\find-plugins.js:152:11)
    at processFile (***\fastify-cli\node_modules\@fastify\autoload\lib\find-plugins.js:124:3)
    at processDirContents (***\fastify-cli\node_modules\@fastify\autoload\lib\find-plugins.js:101:7)
    at buildTree (***\fastify-cli\node_modules\@fastify\autoload\lib\find-plugins.js:41:9)
    at async findPlugins (***\fastify-cli\node_modules\@fastify\autoload\lib\find-plugins.js:14:3)
    at async autoload (***\fastify-cli\node_modules\@fastify\autoload\index.js:20:22)

https://github.com/fastify/fastify-autoload?tab=readme-ov-file#override-typescript-detection-using-an-environment-variable

@mcollina
Copy link
Member

mcollina commented Mar 8, 2025

fastify/fastify-autoload#442 < I think fastify-autoload would need some fixing. I think we can access process.features to detect if there is the support instead of relying on the version number.

@SimoneDevkt
Copy link
Contributor Author

Once strip types ships in Node v20, I'd recommend shipping a new version of this as a semver-major.

Now that Node 20 is in maintenance mode and experimental-strip-types is the default on LTS 22 and 24, should I still leave --experimental-strip-types?

@mcollina
Copy link
Member

mcollina commented Dec 6, 2025

No, drop node 20 and let's move in the future (I'll ship a major).

@SimoneDevkt SimoneDevkt requested a review from kibertoad December 8, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-major Issue or PR that should land as semver major

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants