mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
Compare commits
5 Commits
a8ad4b91d9
...
6918ea0d72
Author | SHA1 | Date | |
---|---|---|---|
|
6918ea0d72 | ||
|
38bfe2a6bc | ||
|
06add6e7fb | ||
|
6aa5d12652 | ||
|
05403910ac |
@ -122,7 +122,25 @@ export default defineNuxtModule<Partial<ImportsOptions>>({
|
|||||||
const scannedImports = await scanDirExports(composablesDirs, {
|
const scannedImports = await scanDirExports(composablesDirs, {
|
||||||
fileFilter: file => !isIgnored(file),
|
fileFilter: file => !isIgnored(file),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const presetMap = new Map<string, string>()
|
||||||
|
|
||||||
|
for (const preset of presets) {
|
||||||
|
preset.imports = preset.imports ?? []
|
||||||
|
for (const i of preset.imports) {
|
||||||
|
presetMap.set(i, preset.from)
|
||||||
|
}
|
||||||
|
presetMap.set(preset.as, preset.from)
|
||||||
|
}
|
||||||
|
|
||||||
for (const i of scannedImports) {
|
for (const i of scannedImports) {
|
||||||
|
const name = i.as ?? i.name
|
||||||
|
const preset = presetMap.get(name)
|
||||||
|
|
||||||
|
if (preset) {
|
||||||
|
console.warn(`[imports] "${name}" is already defined and auto imported from "${preset ?? 'unknown preset'}" within nuxt itself. Please consider renaming "${name}" at ${i.from}.`)
|
||||||
|
}
|
||||||
|
|
||||||
i.priority = i.priority || priorities.find(([dir]) => i.from.startsWith(dir))?.[1]
|
i.priority = i.priority || priorities.find(([dir]) => i.from.startsWith(dir))?.[1]
|
||||||
}
|
}
|
||||||
imports.push(...scannedImports)
|
imports.push(...scannedImports)
|
||||||
|
Loading…
Reference in New Issue
Block a user