2021-02-09 23:47:14 +08:00
|
|
|
/**
|
|
|
|
* Introduces component library styles on demand.
|
|
|
|
* https://github.com/anncwb/vite-plugin-style-import
|
|
|
|
*/
|
|
|
|
|
2021-01-18 22:42:35 +08:00
|
|
|
import styleImport from 'vite-plugin-style-import';
|
|
|
|
|
2021-03-12 21:45:27 +08:00
|
|
|
export function configStyleImportPlugin(isBuild: boolean) {
|
|
|
|
if (!isBuild) return [];
|
2021-05-11 18:56:38 +08:00
|
|
|
const styleImportPlugin = styleImport({
|
2021-01-18 22:42:35 +08:00
|
|
|
libs: [
|
|
|
|
{
|
|
|
|
libraryName: 'ant-design-vue',
|
2021-01-18 23:37:36 +08:00
|
|
|
esModule: true,
|
2021-01-18 22:42:35 +08:00
|
|
|
resolveStyle: (name) => {
|
2021-01-27 21:15:38 +08:00
|
|
|
return `ant-design-vue/es/${name}/style/index`;
|
2021-01-18 22:42:35 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
2021-05-11 18:56:38 +08:00
|
|
|
return styleImportPlugin;
|
2021-01-18 22:42:35 +08:00
|
|
|
}
|