Skip to content
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(runtime-core): only set cache for object keys #6266

merged 2 commits into from Aug 29, 2022


Copy link


On SSR if an unregistered component is used we have a hard crash as we try to cache the details about this component, but it's a string (not a resolved object) and can't be used as a cache key to the WeakMap that's we're using.

It's true this is wrong usage, and there is a helpful warning:

[Vue warn]: Failed to resolve component: SomeThing
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

But there is also a fatal and hard error that occurs:

Fatal error:

Error: WeakMap key must be an object, got comp
    at _evaluate (
    at <anonymous> (<anonymous>)


import { createSSRApp } from 'vue';
import { renderToString } from 'vue/server-renderer';

const app = createSSRApp({
  template: `<SomeThing />`,

console.log(await renderToString(app));

@yyx990803 yyx990803 merged commit c3465c1 into vuejs:main Aug 29, 2022
9 checks passed
@danielroe danielroe deleted the fix/cache-set branch August 29, 2022 08:00
chrislone pushed a commit to chrislone/core that referenced this pull request Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants