lib.format
- Type:
'esm' | 'cjs' | 'umd' | 'mf' | 'iife' - Default:
'esm' - CLI:
--format <format>(e.g.--format umd)
Specify the output format for the generated JavaScript output files.
For different output formats, Rslib uses the following default value of output.library.type provided by Rspack:
esm:modern-module
Info
You can enable Rspack experimental ESM output by setting lib.experiments.advancedEsm to emit ESM output that is high-quality, more friendly to static analysis, and supports code splitting.
cjs:commonjs-staticumd:umdiife: modern-module with output.iife enabled.
See Output Format and Module Federation for more details.
Note
The umd, mf and iife formats only work when bundle is set to true.
