I want to short cut the import string.
My project structure:
Root
├── assets
│ ├── _root
│ │ ├── submodule.ts
│ │ ├── global.ts // export module
│ ├── scripts
│ │ ├── test.ts
│ │ ├── other.ts // Importer
...
//file global.ts
export module global {}
//file test.ts
import { global } from './../_root/global' //< long sytax
I tried to modify my tsconfig.json
{
/* Base configuration. Do not edit this field. */
"extends": "./temp/tsconfig.cocos.json",
/* Add your custom configuration here. */
"compilerOptions": {
"strict": false,
"target": "es2019",
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"paths": {
"@global": ["assets/_root/global"]
}
}
}
now all I need to do is:
//file test.ts
import { global } from '@global' //< Error, can not regconize the @global
Please tell me how to fix this. Tks alot