Blame view

build/vite/plugin/styleImport.ts 518 Bytes
vben authored
1
2
3
4
5
/**
 *  Introduces component library styles on demand.
 * https://github.com/anncwb/vite-plugin-style-import
 */
vben authored
6
7
import styleImport from 'vite-plugin-style-import';
8
9
export function configStyleImportPlugin(isBuild: boolean) {
  if (!isBuild) return [];
vben authored
10
11
12
13
  const pwaPlugin = styleImport({
    libs: [
      {
        libraryName: 'ant-design-vue',
vben authored
14
        esModule: true,
vben authored
15
        resolveStyle: (name) => {
vben authored
16
          return `ant-design-vue/es/${name}/style/index`;
vben authored
17
18
19
20
21
22
        },
      },
    ],
  });
  return pwaPlugin;
}