-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Align glob raw support syntax with future standards #7017
Comments
I saw the conversation on Twitter and it confirms my impression that import assertions should not affect module evaluation semantics. However, the import reflection proposal will likely take quite some time to go through (if it ever does). I do like the Either way, we should stop leaning on import assertions as transform hints. To align with the current import reflections spec, the glob import should be changed to: const examples = import.meta.glob('./examples/*.html', { as: 'raw' }) We can deprecate the previous syntax and mark this one as experimental so that we can adjust it per spec. I think it's safe to do so because even if the spec changes, the required code change will likely be trivial and can be done automatically across the codebase. If the spec doesn't go through, I still think In the meanwhile, we should keep the current query-based hints until import reflections goes stage 3. |
We talked about this PR and we think we should add |
vitejs#7017) BREAKING CHANGE: Use `import.meta.globEager('/dir/*.js', { as: 'raw' })` instead of `import.meta.globEager('/dir/*.js', { assert: { type: 'raw' } })` (it will be deprecated in Vite 3.0).
vitejs#7017) BREAKING CHANGE: Use `import.meta.globEager('/dir/*.js', { as: 'raw' })` instead of `import.meta.globEager('/dir/*.js', { assert: { type: 'raw' } })` (it will be deprecated in Vite 3.0).
PR implementing this: #7215. |
vitejs#7017) BREAKING CHANGE: Use `import.meta.globEager('/dir/*.js', { as: 'raw' })` instead of `import.meta.globEager('/dir/*.js', { assert: { type: 'raw' } })` (it will be deprecated in Vite 3.0).
Clear and concise description of the problem
We added support for raw glob imports in Vite 2.8 (#5545), trying to align the syntax with the import assertions proposal:
@lucacasonato is pointing out that the import reflection proposal should have been used instead.
We should avoid moving more suffix-based modifiers until it is more clear how these proposals will evolve. For the glob raw syntax, let's discuss if we should mark it as deprecated and prepare users to move to a more aligned syntax once we release Vite 3.0
Suggested solution
Deprecate
{ assert: { type: 'raw' }}
, delay further changes in import modifiersAlternative
No response
Additional context
See twitter thread
Validations
The text was updated successfully, but these errors were encountered: