mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
fix: allow for components to begin with the names of modifiers
This commit is contained in:
parent
cd7e85842c
commit
51f20645d9
@ -44,7 +44,9 @@ export const loaderPlugin = createUnplugin((options: LoaderOptions) => {
|
||||
const nuxt = tryUseNuxt()
|
||||
// replace `_resolveComponent("...")` to direct import
|
||||
s.replace(/(?<=[ (])_?resolveComponent\(\s*["'](lazy-|Lazy)?(Idle|Visible|idle-|visible-|Event|event-)?([^'"]*)["'][^)]*\)/g, (full: string, lazy: string, modifier: string, name: string) => {
|
||||
const component = findComponent(components, name, options.mode)
|
||||
const normalComponent = findComponent(components, name, options.mode)
|
||||
const modifierComponent = !normalComponent && modifier ? findComponent(components, modifier + name, options.mode) : null
|
||||
const component = normalComponent || modifierComponent
|
||||
if (component) {
|
||||
// @ts-expect-error TODO: refactor to nuxi
|
||||
if (component._internal_install && nuxt?.options.test === false) {
|
||||
@ -73,7 +75,7 @@ export const loaderPlugin = createUnplugin((options: LoaderOptions) => {
|
||||
|
||||
if (lazy) {
|
||||
imports.add(genImport('vue', [{ name: 'defineAsyncComponent', as: '__defineAsyncComponent' }]))
|
||||
if (nuxt?.options.experimental.delayedHydration === true && modifier) {
|
||||
if (modifier && normalComponent && nuxt?.options.experimental.delayedHydration === true) {
|
||||
switch (modifier) {
|
||||
case 'Visible':
|
||||
case 'visible-':
|
||||
|
Loading…
Reference in New Issue
Block a user