Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as AllComponents from 'element-plus'
import * as AllIcons from '@element-plus/icons-vue'
import type { ElIdInjectionContext, ElZIndexInjectionContext } from 'element-plus'
import type { Component } from 'vue'
import { getComponentPath } from './core/components'
import { isVueComponent } from './utils'
import type { ModuleOptions, PresetDirectives, PresetImport } from './types'

Expand All @@ -29,11 +28,7 @@ export const allImportsWithStyle: string[] = [
'ElNotification'
]

const allImports: PresetImport[] = [
...allImportsWithStyle.map((name) => {
return [name, getComponentPath(name)] as PresetImport
})
]
const allImports: PresetImport[] = []

const allBaseImports: PresetImport[] = [
['ID_INJECTION_KEY', 'es/hooks/use-id/index.mjs'],
Expand Down
8 changes: 6 additions & 2 deletions src/core/imports.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { addImportsSources } from '@nuxt/kit'
import { iconLibraryName, libraryName } from '../config'
import { allImportsWithStyle, iconLibraryName, libraryName } from '../config'
import { genIconPresets, resolvePath, toArray } from '../utils'
import type { ModuleOptions, PresetImport } from '../types'
import { getComponentPath } from './index'

function _resolveImports (imports: Set<PresetImport>) {
imports.forEach(async ([name, path]) => {
Expand All @@ -15,7 +16,10 @@ function _resolveImports (imports: Set<PresetImport>) {
export async function resolveImports (config: ModuleOptions) {
const { imports, icon } = config
const icons = icon !== false ? genIconPresets(icon) : []
const allImports = new Set(imports)
const importsWithStyle = allImportsWithStyle.map((name) => {
return [name, getComponentPath(name)] as PresetImport
})
const allImports = new Set([...imports, ...importsWithStyle])
const allIcons = new Set(icons)

_resolveImports(allImports)
Expand Down