Prerequisites
🚀 Feature Proposal
I'm working on a Fastify application created with the Fastify CLI, and I would like to add support for path aliases.
Currently, I have to use long relative paths like this:
import { hello } from '../../../hello.js';
It would be much more convenient to use a path alias, allowing me to write:
import { hello } from '@/hello.js';
I've configured my tsconfig.json as follows to set the path alias:
{
"extends": "fastify-tsconfig",
"compilerOptions": {
"outDir": "dist",
"strict": true,
"strictNullChecks": true,
"skipLibCheck": true,
"sourceMap": true,
"moduleResolution": "NodeNext",
"module": "NodeNext",
"target": "ES2022",
"esModuleInterop": true,
"baseUrl": "src",
"paths": {
"@/*": ["./*"]
}
},
"include": ["src/**/*.ts"]
}
However, I'm unsure how to pass options to node itself when using the Fastify CLI to start my app.
For reference, here is a related discussion on Stack Overflow: ESM does not resolve module-alias.
Motivation
No response
Example
No response
Prerequisites
🚀 Feature Proposal
I'm working on a Fastify application created with the Fastify CLI, and I would like to add support for path aliases.
Currently, I have to use long relative paths like this:
It would be much more convenient to use a path alias, allowing me to write:
I've configured my tsconfig.json as follows to set the path alias:
{ "extends": "fastify-tsconfig", "compilerOptions": { "outDir": "dist", "strict": true, "strictNullChecks": true, "skipLibCheck": true, "sourceMap": true, "moduleResolution": "NodeNext", "module": "NodeNext", "target": "ES2022", "esModuleInterop": true, "baseUrl": "src", "paths": { "@/*": ["./*"] } }, "include": ["src/**/*.ts"] }However, I'm unsure how to pass options to node itself when using the Fastify CLI to start my app.
For reference, here is a related discussion on Stack Overflow: ESM does not resolve module-alias.
Motivation
No response
Example
No response