Running yarn build
in some conditions on cicd pipelines, e.g. Jenkins, produces weird hard to read output like this:
yarn build:prod
[2K[1G[1myarn run v1.22.15[22m
...
��� Browser application bundle generation complete
How to make clean and readable log output?
This is related to two issues.
Color terminal coding output to mono terminal.
This can be resolved in Dockerfile adding color configuration:
RUN npm config set color false && yarn config set color false && yarn config set emoji false
It disables npm and yarn color and also emoji coding in terminal output, and results in cleaner, easier to read output.
Character coding issue.
The question-mark symbols are actually indication of UTF/Unicode encoding display errors.
The root cause for this is that build terminal does not support UTF. To resolve this, you need to set UTF-8 based LANG setting in build environment.
Example:
export LANG=en_US.UTF-8
After these mods, output looks like this:
yarn build:prod
yarn run v1.22.19
...
✔ Browser application bundle generation complete.