Skip to content

Commit

Permalink
fix(rax-app): debug() run as needed and optimizing stringify (#1029)
Browse files Browse the repository at this point in the history
* fix(rax-app): debug()  run as needed and replace JSON.stringify with util.inspect for circular

* docs(rax-app): change version, readme and comment
  • Loading branch information
shiftj18 authored Aug 16, 2023
1 parent 0e750d3 commit 6c86dba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 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
16 changes: 6 additions & 10 deletions packages/plugin-rax-app/src/utils/logWebpackConfig.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import debugCore from 'debug';
import { inspect } from 'util';

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

export default (configs) => {
try {
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));
// Only executed when the debug mode is turned on
if (debug.enabled) {
// Print webpack configs for easy debugging
debug(inspect(configs, { depth: 10, colors: true }));
}
} catch (error) {
// ignore error
}
Expand Down

0 comments on commit 6c86dba

Please sign in to comment.