@huanxinyin
I created a demo for you. It is very straight forward.
Set baseUrl and paths under compilerOptionsin tsconfig.json
Then import using your path name like this:
In my demo I have one cc.Label that says Default string by default, but has a component label-update.component.ts on it that will replace the cc.Label string into the value you get from the import in your component.
When you run the game in development mode you get as expected:

But problem comes from compiling the game (building it) and running it after the build it doesn’t work:

With errors from import:
The project I used to take these screenshot and prove my point is also attached into this post.
Thanks, hope you can fix it since it would clean up projects a lot.
typescript-path-compile-error.zip (954.7 KB)




