Replies: 2 comments 5 replies
-
Noting that query params are a hack and a solution using import assertions would be preferred here: import penguinUrl from '../images/penguin.png' assert { type: 'url' }; I think this is significant and warrants our consideration. Intellisense is presently unkind to the query params hack. Assertions are supported in TS now (and AFAIK in our existing language syntax, compiler, and the acorn (?) lexer we use). Maybe all of this doesn’t mean the query params hack is a show stopper, but once v1.0 ships would we turn around and deprecate it a week or a few months later once it’s settled in Vite? Or would want to have multiple ways to do this for a long time? I think it’s worth seriously considering some pros and cons. Finally, in a potential catch 22, the last response from Vite was kinda like permission for us to move this along in a PR. link |
Beta Was this translation helpful? Give feedback.
-
A big downside here is that we have spent the last several months heavily encouraging the use of Astro.resolve for adding any types of assets. I'm suspecting that there are a lot of projects that use it heavily. We need a good migration strategy for them. Would it make sense to have a version in which Astro.resolve is deprecated and removed as a runtime resolver, but still allow the compiler to turn usage into static imports? And then message that way? |
Beta Was this translation helpful? Give feedback.
-
In order to improve build performance we want to prevent scanning rendered HTML in order to discover what assets are used inside of a user's
src/
folders. In order to achieve this we need for usage to be static.Given that assets can be added using an import specifier like:
With #23 there is a proposal for sugar around the above. If that proposal goes through we should deprecate Astro.resolve.
Rough proposal
src/
using import specifiers and/or [Draft] Relative path handling in Astro #23 if that goes through.Astro.resolve
in a major version.Beta Was this translation helpful? Give feedback.
All reactions