Skip to content

Commit

Permalink
docs(rax-app): change version, readme and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftj18 committed Aug 16, 2023
1 parent e004f16 commit 268a69b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
3 changes: 3 additions & 0 deletions packages/plugin-rax-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 7.0.14
- Fix: change `debug(JSON.stringify(configs, ...))` to run only in debug mode, and modify the implement of `stringify` that will cause Node16 Crash when `configs` has many circular reference in `logWebpackConfig.js`

## 7.0.12

- Feat: breaking change for `rax-webpack-config` to update `postcss-loader`
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-rax-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-rax-app",
"version": "7.0.13",
"version": "7.0.14",
"description": "The basic webpack configuration for rax project",
"author": "Rax Team",
"main": "lib/index.js",
Expand Down
21 changes: 4 additions & 17 deletions packages/plugin-rax-app/src/utils/logWebpackConfig.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
import debugCore from 'debug';
import { inspect } from 'util';

const debug = debugCore('rax-app');

export default (configs) => {
try {
// 用 JSON.stringify 的 replacer 解 cyclic object value 的方式,在 Node16 上面会 Crash,所以改用 util.inspect 实现
// https://stackoverflow.com/questions/11616630/how-can-i-print-a-circular-structure-in-a-json-like-format
// Node Crash 问题,主要出现在 less@^4 importManager.less.importManager 等循环场景,详见 https://code.alibaba-inc.com/clam-eco/clam/issues/550723
// 另外,仅在开启 debug 模式下才执行内容,避免干扰普通 build 功能 & 影响性能
// Only executed when the debug mode is turned on
if (debug.enabled) {
// const tmp = [];
// debug(JSON.stringify(configs, (key, val) => {
// if (val != null && typeof val === 'object') {
// if (tmp.indexOf(val) >= 0) {
// return;
// }
// tmp.push(val);
// }
// return val;
// }, 2));

const configsStr = require('util').inspect(configs, { depth: 10, colors: true });
debug(configsStr);
// Print webpack configs for easy debugging
debug(inspect(configs, { depth: 10, colors: true }));
}
} catch (error) {
// ignore error
Expand Down

0 comments on commit 268a69b

Please sign in to comment.