build: fix mutli format build script

This commit is contained in:
Evan You 2024-12-10 08:21:18 +08:00
parent c2ff3bd564
commit 017c860d86
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
2 changed files with 6 additions and 3 deletions

View File

@ -98,7 +98,7 @@ const outputConfigs = {
const defaultFormats = ['esm-bundler', 'cjs']
/** @type {ReadonlyArray<PackageFormat>} */
const inlineFormats = /** @type {any} */ (
process.env.FORMATS && process.env.FORMATS.split(',')
process.env.FORMATS && process.env.FORMATS.split('+')
)
/** @type {ReadonlyArray<PackageFormat>} */
const packageFormats = inlineFormats || packageOptions.formats || defaultFormats

View File

@ -5,14 +5,17 @@ Produces production builds and stitches together d.ts files.
To specify the package to build, simply pass its name and the desired build
formats to output (defaults to `buildOptions.formats` specified in that package,
or "esm,cjs"):
or ["esm-bundler", "cjs"]):
```
# name supports fuzzy match. will build all packages with name containing "dom":
nr build dom
# specify the format to output
nr build core --formats cjs
nr build vue -f cjs
# to specify multiple formats, separate with "+":
nr build vue -f esm-bundler+esm-browser
```
*/