-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 Astro.resolve deprecation warning for the static build #2416
Conversation
🦋 Changeset detectedLatest commit: bf140b6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✔️ Deploy Preview for astro-docs-2 ready! 🔨 Explore the source changes: 6746122 🔍 Inspect the deploy log: https://app.netlify.com/sites/astro-docs-2/deploys/61e722e6722eb50008a023fc 😎 Browse the preview: https://deploy-preview-2416--astro-docs-2.netlify.app |
✔️ Deploy Preview for astro-docs-2 ready! 🔨 Explore the source changes: bf140b6 🔍 Inspect the deploy log: https://app.netlify.com/sites/astro-docs-2/deploys/61e7233ca0ef91000740b0ee 😎 Browse the preview: https://deploy-preview-2416--astro-docs-2.netlify.app |
closes #2315 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question, otherwise LGTM!
@@ -34,6 +38,26 @@ export function createResult(args: CreateResultArgs): SSRResult { | |||
params, | |||
url, | |||
}, | |||
resolve(path: string) { | |||
if(astroConfig.buildOptions.experimentalStaticBuild) { | |||
let extra = `This can be replaced with a dynamic import like so: await import("${path}")`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need ?url
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for images at least. I'm not sure when it's needed or not, actually. I guess we could look for common image extensions and a more specific warning like with CSS, and then fallback to using ?url
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you, not blocking!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think we'll leave it like this for now as I'm not certain what situations require using ?url
. Can add that later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was slightly distracted by the isCSSRequest
optimization and the addition of logging
, but otherwise good.
` | ||
} | ||
|
||
warn(args.logging, `deprecation`, `${bold('Astro.resolve()')} is deprecated. We see that you are trying to resolve ${path}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where logging
gets used, yea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep
…#2416) * Add Astro.resolve deprecation warning for the static build * Adds a changeset
Changes
If
astroConfig.buildOptions.experimentalStaticBuild
is true, a deprecation warning is added forAstro.resolve
. It will always return an empty string so that there is no confusion about it working.Special warning for CSS with recommendation to use style imports instead:
Regular warning: