styleImport.ts 505 B

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