IDE識別路徑別名

方法1、在項目根路徑下新建 jsconfig.json 文件(適用於VSCode),內容以下node

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    },
    "target": "ES6",
    "module": "commonjs",
    "allowSyntheticDefaultImports": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}

方法2、項目根目錄下新建 jsconfig.js 文件(適用於JetBrain系列),內容以下:json

System.config({
  "paths": {
     "@/*": "./src/*"
  }
});
相關文章
相關標籤/搜索