-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix: isSelfAccepting
? More like isBanishedToTheShadowRealm
#2852
Conversation
🦋 Changeset detectedLatest commit: 15dbbf7 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 |
@@ -75,7 +83,7 @@ export async function render(renderers: SSRLoadedRenderer[], mod: ComponentInsta | |||
children: '', | |||
}); | |||
scripts.add({ | |||
props: { type: 'module', src: '/@id/astro/client/hmr.js' }, | |||
props: { type: 'module', src: new URL('../../../runtime/client/hmr.js', import.meta.url).pathname }, |
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 one is surprising! Any idea why this was required / what kind of error message you were seeing?
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.
It really is! I was seeing the following when Vite tried to resolve the module. Notice Astro returns a 404 as well:
14:23 PM [vite] Internal server error: Cannot set property 'isSelfAccepting' of undefined
Plugin: vite:import-analysis
File: /Users/benholmes/Sandbox/astro-integration-react/node_modules/.vite/astro_client_load_js.js?v=7a24946c
at ModuleGraph.updateModuleInfo (/Users/benholmes/Sandbox/astro-integration-react/node_modules/vite/dist/node/chunks/dep-9c153816.js:53418:29)
at TransformContext.transform (/Users/benholmes/Sandbox/astro-integration-react/node_modules/vite/dist/node/chunks/dep-9c153816.js:70072:57)
at async Object.transform (/Users/benholmes/Sandbox/astro-integration-react/node_modules/vite/dist/node/chunks/dep-9c153816.js:38334:30)
at async doTransform (/Users/benholmes/Sandbox/astro-integration-react/node_modules/vite/dist/node/chunks/dep-9c153816.js:53030:29)
7:14:23 PM [vite] Internal server error: Cannot set property 'isSelfAccepting' of undefined
Plugin: vite:import-analysis
File: /Users/benholmes/Sandbox/astro-integration-react/node_modules/.vite/astro_client_hmr_js.js?v=7a24946c
at ModuleGraph.updateModuleInfo (/Users/benholmes/Sandbox/astro-integration-react/node_modules/vite/dist/node/chunks/dep-9c153816.js:53418:29)
at TransformContext.transform (/Users/benholmes/Sandbox/astro-integration-react/node_modules/vite/dist/node/chunks/dep-9c153816.js:70072:57)
at async Object.transform (/Users/benholmes/Sandbox/astro-integration-react/node_modules/vite/dist/node/chunks/dep-9c153816.js:38334:30)
at async doTransform (/Users/benholmes/Sandbox/astro-integration-react/node_modules/vite/dist/node/chunks/dep-9c153816.js:53030:29)
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.
☝️ After tracing Vite's internal logs, there's a different ?v=XXXXX
attached to the end of the URL between calls. It seems to think the file changed even when it hasn't...
@@ -40,11 +40,19 @@ export type ComponentPreload = [SSRLoadedRenderer[], ComponentInstance]; | |||
export type RenderResponse = { type: 'html'; html: string } | { type: 'response'; response: Response }; | |||
|
|||
const svelteStylesRE = /svelte\?svelte&type=style/; | |||
const rendererCache = new Map<string, SSRLoadedRenderer['ssr']>(); |
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.
Can you leave a comment here that this is required to prevent bugs? I removed it assuming it was no longer needed for perf, but had no idea it was running defense on bugs!
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.
Yeah, I'm curious if it ever was running defense on bugs to be honest. It seemed like a performance choice to me as well. I'll add a note 👍
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.
Updated!
Also... changeset :) |
I'll never change(set) this is who I am |
LGTM! Merging for you so that we can get a release out to test against |
…stro#2852) * fix: restore renderer caching strategy * fix: restore old URL constructor for HMR * docs: comment why we need the rendererCache * refactor: remove needless "else" * chore: changeset
Changes
ssrLoadModule
Testing
Had to test by hand, manually copying the
dist
to anode_modules
folder to avoid false positives. I encourage other devs to do the same, or install directly from this GitHub branch!Docs
N/A