Closed thekidchad closed 6 years ago
duplicate of #4996
solution: https://github.com/zeit/next.js/issues/4996#issuecomment-417991907
if you open the Google chrome console in your website, you will see the error: "undefined is not a function"
Exactly, Next.js by itself works in Chrome 41, so you’re using a npm package that was not transpiled before publishing.
@timneutkens would be nice to have somewhere in the documentation a warning to the possibility of this error, since we're 100% blind until see the website indexed with this title
I don't know where that would fit as no one reads all of the docs at once most of the time and it's not really an issue Next.js causes. If you use another framework you'll get into the same issue except if that framework compiles all node_modules.
I guess the best thing we could do is try and detect it on a bundle level. Which sounds like an interesting case for a webpack plugin. This would be very complex though, and possibly slowing down the build a bit.
What's the point of throwing an error into title in the production environment in the first place? Why on earth would you do that if (as we see) it affects how search engines see it? 'Cause just before the error, the title is exactly how is should be.
What is more, an excuse that:
no one reads all of the docs at once
makes no sense. If it's not in the docs, there's only issues to be found 😄 So, it's better to find it in the docs than to not have it at all.
NextJS is usually used because of SSR and that usually is requirement because of SEO. This hurts SEO. That's why it's worth having this case described in the docs.
And it's quite hard to debug too. For example, our project works in Chrome 41 while in dev build. It doesn't while built for production. And in production build, you see only two letter variables and errors such as:
TypeError: undefined is not a function
Which says nothing.
Gonna try to make it spit the source-maps or just not minify things... Or sth...
Maybe you have better tips how to debug production build?
Like I said before it's not a Next.js issue:
Exactly, Next.js by itself works in Chrome 41, so you’re using a npm package that was not transpiled before publishing.
It's something you're adding to your application that is incorrectly published to npm or is not meant to be used in older browsers / in a browser environment.
Feel free to write up a RFC to solve the issue / add warnings or another solution, like I said before it's a little more complex than documenting this. There needs to be a way to transpile specific modules. That's tracked here: https://github.com/zeit/next.js/issues/706
Hi, Hope everyone is ok
Describe the bug
In Chrome V68, everything is ok but the problem is with the Chrome used by Google Bot. In fact, in my home page, after building the home page, the title is automatically replaced by ": An unexpected error has occured". You definetely need to go over "to reproduce and dem section"
To Reproduce & Dem
You need to go to https://www.browserling.com/browse/win/7/chrome/41/https://en.vetolib.vet and observe the title. The other page are totally OK.
System information
My Code
document.js :
landing.js (actually it's the home page)
And the famous LandingMeta.js
Thank you so much for your help