Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
Jscherbe opened this issue Sep 20, 2024 · 0 comments
Open
3 tasks done
Labels
enhancement New feature or request

Comments

@Jscherbe
Copy link

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

@Jscherbe Jscherbe added the enhancement New feature or request label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant