vbenjs / vite-plugin-style-import

A plug-in that imports component library styles on demand.it is fast
MIT License
448 stars 59 forks source link

本地正常,生产环境无效? #97

Closed aitrx closed 2 years ago

aitrx commented 2 years ago

安装

 "devDependencies": {
   "vite-plugin-style-import": "^2.0.0",
}

引用

import { createStyleImportPlugin, AndDesignVueResolve } from 'vite-plugin-style-import';

export function styleInportPlugins(){
  return createStyleImportPlugin({
    resolves: [
      AndDesignVueResolve()
    ],
    libs: [
      {
        libraryName: 'ant-design-vue',
        esModule: true,
        resolveStyle: (name) => {
          return `ant-design-vue/es/${name}/style/index`
        },
      },
    ],
  })
}