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 options: module preload

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

build.modulePreload type and default

build.modulePreload is of type boolean | { polyfill?: boolean, resolveDependencies?: ResolveModulePreloadDependenciesFn } with a default value of { polyfill: true }. By default, a module preload polyfill is automatically injected into the proxy module of each index.html entry. The polyfill can be disabled using { polyfill: false }. The polyfill does not apply to Library Mode. There is experimental support for fine-grained control via the resolveDependencies function.

ResolveModulePreloadDependenciesFn type signature

The ResolveModulePreloadDependenciesFn has the signature: (url: string, deps: string[], context: { hostId: string, hostType: 'html' | 'js' }) => string[]. It is called for each dynamic import with a list of chunks it depends on, and for each chunk imported in entry HTML files. It can return a new dependencies array with filtered or injected dependencies with modified paths. The deps paths are relative to build.outDir, and the return value should be a relative path to build.outDir.

build.polyfillModulePreload deprecated

build.polyfillModulePreload is deprecated in favor of build.modulePreload.polyfill. It is of type boolean with a default value of true.

build.modulePreload resolveDependencies example

Example of configuring modulePreload with resolveDependencies: const config = { build: { modulePreload: { resolveDependencies: (filename, deps, { hostId, hostType }) => { return deps.filter(condition) }, }, }, };

Manual module preload polyfill import for custom entry

If the build is configured to use a non-HTML custom entry via build.rolldownOptions.input, it is necessary to manually import the polyfill in your custom entry: import 'vite/modulepreload-polyfill'

Give your agent this brain