Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Supporting custom parameters #2

Closed
ElMassimo opened this issue Mar 28, 2022 · 3 comments
Closed

Supporting custom parameters #2

ElMassimo opened this issue Mar 28, 2022 · 3 comments

Comments

@ElMassimo
Copy link

ElMassimo commented Mar 28, 2022

The current proposal mentions support for a custom query.

I'm wondering if we could make that a bit more idiomatic for URLs that have custom parameters, such as in:

For example, as in this type of use case:

const images = import.meta.importGlob('./dir/*.jpg', { query: { preset: 'full' } })

/* {
  './dir/foo.jpg': () => import('./dir/foo.jpg?preset=full'),
  './dir/bar.jpg': () => import('./dir/bar.jpg?preset=full'),
} */
@antfu
Copy link
Owner

antfu commented Mar 29, 2022

Yeah sounds like a good idea. Want to work on a PR for this?

The as syntax is to align https://github.com/tc39/proposal-import-reflection in the future (we might use it for static import in v3.0 instead of the query). But for now, I think query sounds like a more natural solution (we could throw an error ensure there is no as and query exist at the same time.

@antfu
Copy link
Owner

antfu commented Mar 29, 2022

Working in it :P

@antfu antfu closed this as completed in 75dd920 Mar 29, 2022
@ElMassimo
Copy link
Author

ElMassimo commented Mar 29, 2022

Haha, you are too fast, I just woke up 😄

Thanks Anthony!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants