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

SSR not showing any warning for unknown tag #6998

Closed
IlyaSemenov opened this issue Nov 4, 2017 · 3 comments
Closed

SSR not showing any warning for unknown tag #6998

IlyaSemenov opened this issue Nov 4, 2017 · 3 comments

Comments

@IlyaSemenov
Copy link

Version

2.5.3

Reproduction link

https://jsfiddle.net/semenov/1oa635w8/

Steps to reproduce

Run jsfiddle and note the warning message that is printed to the console.

Then run the same code with SSR:

const Vue = require('vue')
const app = new Vue({
  template: '<div><bing-bang/></div>',
})

const renderer = require('vue-server-renderer').createRenderer()

renderer.renderToString(app, (err, html) => {
  if (err) throw err
  console.log(html)
})

Like this: DEBUG=* node test.js

What is expected?

The SSR rendering prints a warning similar to what client-side rendering emits:

[Vue warn]: Unknown custom element: <bing-bang> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

(found in <Root>)

What is actually happening?

SSR simply renders invalid HTML:

<div data-server-rendered="true"><bing-bang></bing-bang></div>

without any warnings.


This inconsistency makes it hard to refactor big Nuxt.js apps, as missing/unregistered components get silently ignored.

@LinusBorg
Copy link
Member

Doesn't the warning appear on the client anyway?

@IlyaSemenov
Copy link
Author

IlyaSemenov commented Nov 4, 2017

No, at least not on the initial SSR-generated page load (with Nuxt). It only shows a warning on the client when you arrive at the page with <nuxt-link>.

But this is actually a valid point... I would also expect the client to emit that error on the initial load of such SSR-generated page.

@yyx990803
Copy link
Member

FYI It is expected behavior to not warn on the server, because it's possible that the user wants to render a real custom element instead of a Vue component. The warning can only be safely performed on the client where we can check if the element is registered as a real custom element.

Previously it is not warning even on client-side hydration, which is fixed in df82aeb.

lovelope pushed a commit to lovelope/vue that referenced this issue Feb 1, 2018
f2009 pushed a commit to f2009/vue that referenced this issue Jan 25, 2019
aJean pushed a commit to aJean/vue that referenced this issue Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants