codeant-ai-for-open-source[bot] commented on code in PR #41680:
URL: https://github.com/apache/superset/pull/41680#discussion_r3545805411
##########
superset-websocket/src/config.ts:
##########
@@ -17,7 +17,7 @@
* under the License.
*/
-import { merge as _merge } from 'lodash';
+import { merge as _merge } from 'lodash-es';
Review Comment:
Yes — `JSON.parse(readFileSync("/path/to/file"))` can work **if**
`readFileSync` returns a string, or you convert the buffer first.
In Node, `readFileSync()` without an encoding returns a `Buffer`, so the
safe version is:
```ts
import { readFileSync } from 'fs';
const config = JSON.parse(readFileSync(configFile, 'utf8'));
```
That’s a good ESM-friendly replacement here and avoids `require()` entirely.
### Why this is appropriate
- Works in native ESM
- Keeps the config loading simple
- Still supports `config.json` / `config.test.json` at startup and in tests
So yes, this is a valid fix for the issue raised in the thread.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]