frandiox / vite-ssr

Use Vite for server side rendering in Node
MIT License
829 stars 92 forks source link

Non-JS output mode for search engines #120

Open imShara opened 2 years ago

imShara commented 2 years ago

It would be nice to have option that will cut all js-related stuff from server-side-rendered page.

Modern search engines can run javascript on scanning pages, but it cost cpu budget. When you render page on server side especially for search bot, you don't need hydration and javascript could be turned off.

frandiox commented 2 years ago

Forgot to comment earlier. Yeah this is a nice feature. For now, it can be done in user land by just replacing script tags in the returned HTML if the UA matches a bot 👍

imShara commented 2 years ago

Yes, I have already made this by stripping <script> tags with regexp, but parsing output is heavy operation.