new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Vite · Config reference · all subjects

build/ssr

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

ssr.external option type and default

The ssr.external option has type string[] | true. By default, all dependencies are externalized except for linked dependencies (for HMR). If true, all dependencies including linked dependencies are externalized. Explicitly listed dependencies using string[] type will always take priority if they are also listed in ssr.noExternal.

ssr.noExternal option type and default

The ssr.noExternal option has type string | RegExp | (string | RegExp)[] | true. By default, only linked dependencies are not externalized (for HMR). If true, no dependencies are externalized, but dependencies explicitly listed in ssr.external using string[] type can take priority and still be externalized. If ssr.target: 'node' is set, Node.js built-ins will also be externalized by default. If both ssr.noExternal: true and ssr.external: true are configured, ssr.noExternal takes priority and no dependencies are externalized.

ssr.target option type and default

The ssr.target option has type 'node' | 'webworker' with a default value of 'node'. It controls the build target for the SSR server.

ssr.resolve.conditions option type and default

The ssr.resolve.conditions option has type string[]. For ssr.target !== 'webworker', the default is ['module', 'node', 'development|production'] (defaultServerConditions). For ssr.target === 'webworker', the default is ['module', 'browser', 'development|production'] (defaultClientConditions). These conditions are used in the plugin pipeline and only affect non-externalized dependencies during the SSR build. Use ssr.resolve.externalConditions to affect externalized imports.

ssr.resolve.externalConditions option type and default

The ssr.resolve.externalConditions option has type string[] with a default value of ['node', 'module-sync']. These conditions are used during ssr import (including ssrLoadModule) of externalized direct dependencies (external dependencies imported by Vite).

ssr.resolve.mainFields option type and default

The ssr.resolve.mainFields option has type string[] with a default value of ['module', 'jsnext:main', 'jsnext']. It is a list of fields in package.json to try when resolving a package's entry point. This takes lower precedence than conditional exports resolved from the exports field: if an entry point is successfully resolved from exports, the main field will be ignored. This setting only affects non-externalized dependencies.

ssr.resolve.externalConditions configuration example

When using ssr.resolve.externalConditions, run Node with the --conditions flag with the same values in both dev and build to get consistent behavior. For example, when setting ['node', 'custom'], run NODE_OPTIONS='--conditions custom' vite in dev and NODE_OPTIONS="--conditions custom" node ./dist/server.js after build.

Give your agent this brain