tsconfig.json
...
"baseUrl": ".",
"paths": {
"@share/*": [
"../share/*"
]
}
...
jsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@share/*": [
"../share/*"
]
},
"target": "ES6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"include": [
"**/*.ts"
],
"exclude": [
"node_modules"
]
}
在 index.ts 配置require('module-alias/register');
这时候运行,导入import { Rst } from '@share/core/vo';的地方就会报错,提示找不到模块,是不是 module-alias 必须要分开声明啊?不能用星号全部声明?