umijs / babel-plugin-import

Modularly import plugin for babel.
3.15k stars 403 forks source link

feat(customStyleName): 完善customStyleName传参 #603

Closed DawnLck closed 2 years ago

DawnLck commented 2 years ago

补充了file参数,使得开发者能自己控制 style 文件的路径转化,如下

import customName from './customName';
export default defineConfig({
  library: {
    esm: 'babel',
    extraBabelPlugins: [
      [
        'babel-plugin-import',
        {
          libraryName: 'antd',
          libraryDirectory: 'es',
          style: true,
          customStyleName: (name: string, file: Record<string, any>, ...args: any) => { 
               // do something
          },
        },
      ],
    ],
  },
});
afc163 commented 2 years ago

补个用例