Skip to content

Add SFC path to resolver arguments (ie. relative component matching in custom resolver, etc) #802

Open

Description

@Jscherbe

Clear and concise description of the problem

It would be useful to pass the SFC's path to the resolver functions, currently only the extracted name of the component is passed. With the SFC path you could implement a custom resolver that matches components relative to the component that is using it, allowing importing of non-global components.

Suggested solution

Pass sfcPath to "findComponent" and then through to resolver arguments so that resolver can use this information programmatically in resolver.

function resolver(name, sfcPath) { ... }

// Or passing meta/ctx object to support other information in the future
function resolver(name, ctx) { 
  const { sfcPath } = ctx;
  // Do something with path information
}

Alternative

No response

Additional context

Recently I built a Vue application (SSG pre-rendered) that has many pages with unique layouts/content offerings. This would make it so that the pages themselves can stay cleaner (no imports) which is helpful for non Vue developers who are working on content. This way they can create page sections as (components/vue markdown files) and use them directly in the page without the overhead of importing each

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions