Skip to content

增加类似于 webpack path alias 的功能 #2130

@howel52

Description

@howel52

这是一个什么样的功能?

目前在各路由(/lib/routes/*)里引用 utils 需要通过相对路径来引用,可否提供一个类webpack path alias 的功能,通过绝对路径来引用工具包。

这个功能可以解决什么问题?

解决复制粘贴时依赖引用路径不一致问题,让acv三连击更流畅(cmd + a, cmd + c, cmd + v).

before:

File A
const fetch = require('../../utils/axios')

File B
const fetch = require('../../../utils/axios')

after:

File A
const fetch = require('@/utils/axios')

File B
const fetch = require('@/utils/axios')

Metadata

Metadata

Assignees

No one assigned

    Labels

    RSS enhancementNew feature or request to existing RSS

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions