System Information
- Strapi Version: 4.6.0
- Operating System: WIn
- Database: MySql
- Node Version: 18
- NPM Version: 6
- Yarn Version:
How can i setup aliases in strapi typescript project?
I tried to do like this
But after byukd i have the error
How can i setup aliases in strapi typescript project?
I tried to do like this
But after byukd i have the error
I also encountered the same error, hoping for help
To make it work, you need to have tsc-alias
installed as devDependency and modify your build command like so:
"build": "strapi build && tsc --project tsconfig.json && tsc-alias -p tsconfig.json"
Your tsconfig.json
should be something like this:
{
"extends": "@strapi/typescript-utils/tsconfigs/server",
"compilerOptions": {
"outDir": "dist",
"rootDir": ".",
"strictNullChecks": true,
"paths": {
"@src/*": ["./src/*"]
}
},
"include": ["./", "./**/*.ts", "./**/*.js", "src/**/*.json"],
"exclude": ["node_modules/", "build/", "dist/", ".cache/", ".tmp/", "src/admin/", "**/*.test.*", "src/plugins/**"]
}
This will work with the start command(
npm run start
) but with the develop command(``npm run develop) I didn’t manage to make it work.