从零开始搭建后台--Absolute Imports

66 阅读1分钟

在项目中引用中使用绝对路径

根目录新建 jsconfig.json or tsconfig.json内容如下:

{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": ["src"]
}

使用示范

# 文件项目路径 src/config/route
import Button from 'config/routes';

官网链接