umijs / babel-plugin-import

Modularly import plugin for babel.
3.16k stars 404 forks source link

feat: support matching relative path #390

Closed Junyan closed 4 years ago

Junyan commented 4 years ago

webpack alias 配置: '@common/components': 'src/common/components'

因为项目中有各种各样的引用方式,引用到src/common/components/index.js导致无法按需引入。

import { Icon } from '../';
import { Icon } from '../index';
import { Icon } from '../components';
import { Icon } from '@common/components';
import { Icon } from '@common/components/index';

希望支持本地路径,这样上方的引用路径,都能通过插件转成如下形式:

import Icon from '@common/components/Icon';