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: library mode

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.lib fileName and cssFileName example

Example of configuring build.lib with custom fileName and cssFileName: import { defineConfig } from 'vite'; export default defineConfig({ build: { lib: { entry: ['src/main.js'], fileName: (format, entryName) => `my-lib-${entryName}.${format}.js`, cssFileName: 'my-lib-style', }, }, });

build.lib type and configuration

build.lib is of type { entry?: string | string[] | { [entryAlias: string]: string }, name?: string, formats?: ('es' | 'cjs' | 'umd' | 'iife')[], fileName?: string | ((format: ModuleFormat, entryName: string) => string), cssFileName?: string }. The entry defaults to the top-level input option, and one of them is required since the library cannot use HTML as entry. The name is the exposed global variable and is required when formats includes 'umd' or 'iife'. Default formats are ['es', 'umd'], or ['es', 'cjs'], if multiple entries are used. The fileName is the name of the package file output, defaulting to the 'name' in package.json, and can be a function taking format and entryName as arguments. The cssFileName specifies the CSS file output name, defaulting to the same value as fileName if it's a string, otherwise falling back to 'name' in package.json.

build.lib assetsInlineLimit behavior

In Library Mode, build.assetsInlineLimit is ignored and assets will always be inlined, regardless of file size or being a Git LFS placeholder.

build.modulePreload polyfill does not apply to Library Mode

The module preload polyfill does not apply to Library Mode. If you need to support browsers without native dynamic import, you should probably avoid using it in your library.

build.minify does not minify whitespaces in library mode ES format

The build.minify option does not minify whitespaces when using the 'es' format in lib mode, as it removes pure annotations and breaks tree-shaking.

Give your agent this brain