ci010 / electron-vue-next

A starter template for using vue-next with the electron.
https://ci010.github.io/electron-vue-next/
191 stars 27 forks source link

vite.config中引入element-plus时,报模块 ""vite-plugin-style-import"" 没有导出的成员 "styleImport" #70

Closed mollerzhu closed 3 years ago

mollerzhu commented 3 years ago

vite.config中引入element-plus时,报模块 ""vite-plugin-style-import"" 没有导出的成员 "styleImport",这个模板应该如何引入第三方库呢?

mollerzhu commented 3 years ago
const { styleImport } = require('vite-plugin-style-import')

const config = {
  // @ts-ignore
  plugins: [
    vue(),
    styleImport({
      libs: [
        {
          libraryName: 'element-plus',
          esModule: true,
          ensureStyleFile: true,
          resolveStyle: (name) => {
            return `element-plus/lib/theme-chalk/${name}.css`
          },
          resolveComponent: (name) => {
            return `element-plus/lib/${name}`
          }
        }
      ]
    })
  ]
}
mollerzhu commented 3 years ago

不用配置vite.config.js一样可以用element-plus,我还是close吧