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

9 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 configuration for library mode

When bundling a library for distribution, use the build.lib config option. You should externalize dependencies that you do not want to bundle into your library, such as vue or react, using external property in rolldownOptions.

build.lib entry point configuration

build.lib supports both single entry and multiple entries. For single entry, entry is a string path. For multiple entries, entry is an object mapping names to file paths. The name property sets the global variable name for UMD builds.

build.lib.fileName property

The build.lib.fileName property specifies the base filename for the library output. File extensions are automatically added. Default is derived from the library name.

build.lib default output formats

Running vite build with build.lib generates two bundle formats: es and umd for single entry, or es and cjs for multiple entries.

build.lib.formats configuration option

The build.lib.formats option allows you to configure which output formats are generated for your library.

build.lib.cssFileName for CSS output

The build.lib.cssFileName option allows you to change the output filename for bundled CSS. By default, it uses build.lib.fileName.

Library mode CSS bundling

If a library imports any CSS, it will be bundled as a single CSS file besides the built JS files. You can export this CSS file in package.json for users to import directly.

File extension behavior in library mode

If package.json does not contain "type": "module", Vite will generate different file extensions for Node.js compatibility. .js becomes .mjs and .cjs becomes .js.

import.meta.env in library mode

In library mode, all import.meta.env.* usage is statically replaced when building for production. However, process.env.* usage is not, so consumers can dynamically change it. You can use define: { 'process.env.NODE_ENV': '"production"' } to statically replace them.

Give your agent this brain