-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
fix(assets): allow absolute ?raw imports from publicDir #21387
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
base: main
Are you sure you want to change the base?
Conversation
|
While I understand the motivation, it feels confusing to me that the content won't change even if you change the content after bundling. This behavior differs from other behaviors related to the public directory. An output like below would behave like I'd expect, but it'll require TLA. const res = await fetch('/_redirect')
const content = await res.text()
export default content |
|
I think this behavior already comes from the existing implementation in Should this PR also change that behavior? Regarding the point:
This feels like a different issue to me, rather than something introduced by this PR. |
Yes, and that's fine because that behavior only exists for non-public files which is meant to be bundled.
It is a behavior introduced by this PR by allowing |
|
Thanks for pointing this out. Would it be acceptable to allow This would better match the expected behavior of public assets. If this approach turns out to be too complex for me to implement correctly, I may close this PR and revisit it later. |
I think this is fine for me since |
I think this is not a problem because I'd expect the bundled assets (i.e. the assets not in the public directory) to be immutable. On the other hand, I don't think assets in public directory can be always treated as immutable.
I'm not sure if I follow this question. I think the assets in the public directory are always externalized from the bundle. |
|
It's about your comment:
I wonder if there are current behaviors you're thinking of that makes this feature request an odd one out. I still think though that supporting |
What is this PR solving?
This PR fixes an issue where absolute
?rawimports from files inpublicDir(e.g./raw.txt?raw) throw an import analysis error, even though they work correctly at runtime.This mismatch causes unnecessary IDE errors and confusion for users.
Fixes #21277