Unable to put unique path for sharable files in tsconfig

Hi all, I have back end and front end folders in one project and I want to have sharable files for both of them. So I decided to declare “sharable” path folder, but I am getting error:


here is my tsconfig:

{
    /* Base configuration. Do not edit this field. */
    "extends": "./temp/tsconfig.cocos.json",

    /* Add your custom configuration here. */
    "compilerOptions": {
        "strict": false,
        "esModuleInterop": true,
        "paths": {
            "db://internal/*": [
                "D:\\storage\\CocosDashboard\\resources\\.editors\\Creator\\3.7.0\\resources\\resources\\3d\\engine\\editor\\assets\\*"
            ],
            "db://assets/*": ["D:\\my_work\\cocos\\Robot_Game\\assets\\*"],
            "db://colyseus-sdk/*": [
                "D:\\my_work\\cocos\\Robot_Game\\extensions\\colyseus-sdk\\runtime\\*"
            ],
            "db://sharable/*": [
                "D:\\my_work\\cocos\\Robot_Game\\colyseus_server\\src\\sharable\\*"
            ]
        }
    }
}

Have you tried changing the name of the sharable folder, does it work?

Hi, it is recommended that you use the import map method to handle this issue

Hi, sorry, don’t understand what you mean about “imports map method”.

Here is the structure of my project, I am trying to use sharable files between front end and back end…

I included sharable folder path, even added there tsconfig.json, but in Cocos Editor I still see these errors:

In the official Creator documentation, there is a way to use the import map, which you can refer to

https://docs.cocos.com/creator/manual/en/scripting/modules/import-map.html

https://docs.cocos.com/creator/manual/en/scripting/modules/spec.html

it does not work at all

How do you use it?

I have added import-map.json and set it up in project settings
{
“imports”: {
“scripts”: “./assets/scripts/”
}
}

and in tsconfig.json:

{
/* Base configuration. Do not edit this field. */
“extends”: “./temp/tsconfig.cocos.json”,

/* Add your custom configuration here. /
“compilerOptions”: {
“strict”: false,
“target”: “es2019”,
“paths”: {
"scripts/
": ["./assets/scripts/*"]
}
}
}

in VSCode no error but creator show a bunch of errors:

You need to Use the top menu bar - Developer - Clean - Clean Code Cache or Restart the project.

Also, I have provided my test project, based on version 3.7.2


image

NewProject_3.zip (10.3 KB)