Skip to content

Docs clarification for SSR /index.html variables in app-vite v2: should {{ someProp }} now be {{ ssrContext.someProp }}?Β #18246

@NoZ915

Description

@NoZ915

Description

I followed the official Quasar App Vite Upgrade Guide v2, and the upgrade process itself completed normally. The project also started successfully.

(Upgrade Guide: https://quasar.dev/quasar-cli-vite/upgrade-guide)

However, after opening the page in the browser, I hit an SSR template variable error.

In my /index.html, I originally had:

{{ someProp }}

This worked in v1, but after upgrading to v2 it became undefined / not found.

Changing it to:

{{ ssrContext.someProp }}

made it work again.

What I found

The current SSR docs still say that:

  • you can set ssrContext.someProp = 'some value' in a boot file
  • and then reference it in /index.html as {{ someProp }}

(Configuring SSR: https://quasar.dev/quasar-cli-vite/developing-ssr/configuring-ssr/#boot-files)

But from the v2 source code, it looks like the render-template behavior has changed to:

  • variable: 'ssrContext'
  • and built-in interpolations were also changed from {{ _meta.headTags }} to {{ ssrContext._meta.headTags }}

(Commit: 2e47188)

The @quasar/app-vite-v2.0.0-beta.1 release notes also mention:

  • perf(app-vite): SSR render-template in specific esm or cjs form, according to host project; interpolation by variable

(Release note: https://github.com/quasarframework/quasar/releases/tag/%40quasar%2Fapp-vite-v2.0.0-beta.1)

Question

In @quasar/app-vite v2, for user-defined SSR /index.html variables, should the correct syntax now be:

{{ ssrContext.someProp }}

instead of the currently documented form:

{{ someProp }}

If yes, should the documentation be updated?

Additional note

My current understanding is that this does not look like an incomplete local ESM migration issue, but rather a change in SSR template scope behavior in v2 while the docs example still reflects the old syntax.

If I am misunderstanding this, please let me know. Thanks.

Documentation Section URL

https://quasar.dev/quasar-cli-vite/developing-ssr/configuring-ssr/#boot-files

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions