Files
test-repo/scripts/build

Prettier Build Script

Requirements

  • Node.js version >= 14.18.

Usage

yarn build

Flags

--playground

Run script with --playground flag will only build files needed for the website.

yarn build --playground

--print-size

To print the bundled file sizes:

yarn build --print-size

--file

To build specific file(s):

yarn build --file=esm/parser-babel.mjs
yarn build --file=standalone.js --file=parser-meriyah.js

--save-as

To save bundled file to a different location, this flag can only use together with ONE --file flag

yarn build --file=parser-babel.js --save-as=babel-for-test.js

--report

Visualize and analyze your esbuild bundle to see which modules are taking up space.

Report file saved next to the bundled file with .report.html suffix.

yarn build --report

--minify and --no-minify

By default, the file minification is controlled by config.mjs and bundler.mjs, these flags are added to override that behavior.

These should only be used for debugging purposes, suggest to use them together with the --file flag.

Force minify files:

yarn build --file=index.js --minify

Disable minify files:

yarn build --file=parser-babel.js --no-minify

--no-babel

Currently, we need babel to transform/shim following new language features:

  • Array#flat() for Node.js 10
  • Array#flatMap() for Node.js 10
  • Object.fromEntries() for Node.js 10

When debugging the build script, we may want skip this step, so the build process can be faster.

Playground use this flag to speed up the build too.

--babel have no effect, don't use.

yarn build --file=index.js --no-babel