You can apply configurations to all your pages, a subset of pages, or one page only.
Example of configuring the Layout and ssr settings:
Technically:
/pages/+config.js applies to /pages/**
/pages/admin/+config.js applies to /pages/admin/**
/pages/product/@id/+config.js applies to /pages/product/@id/**
This means that /pages/+config.js doesn't necessarily apply to all pages, for example if a page is defined at /somewhere-else/+Page.js. But assuming that all pages are defined under /pages/** then /pages/+config.js does apply to all pages.
Likewise /pages/product/@id/+config.js may apply to more than one page, but assuming /pages/product/@id/+Page.js is the only page defined under /pages/product/@id/** then it applies only to that one page.
The config inheritance mechanism is a powerful way to configure your pages. For example, you can use two completely different rendering strategy: some pages can use Vue without SSR while other pages can use React with SSR.
Pointer imports
Internally, Vike transforms this:
Into:
This enables Vike to load the file /pages/+config.js without having to load LayoutDefault.jsx. Vike can quickly load all your +config.js files, without having to load any runtime code.
These fake imports, which we call pointer imports, apply only to +config.js files. Imports in other + files are normal imports as usual.
It's similar to when you import images:
Vike transforms an import inside +config.js to be a pointer import if and only if it resolve to a .jsx file, a .vue file, or any other file that doesn't end with .js or .ts (or .mjs/.mts/.cjs/.cts). For example:
A .jsx or .vue file is always meant to be client- / server-side runtime code. (I.e. it's never used for config logic.) That's why it makes sense that Vike always treats .jsx and .vue as pointer imports.
Manually mark pointer imports
You can manually mark an import to be a pointer import:
The with { type: 'pointer' } import attribute isn't implement yet, see workaround at #1500.
Config code isn't runtime code
The config code in itself is never included in runtimes: