chore: Remove ts-node usage#931
Merged
Merged
Conversation
chargome
approved these changes
May 21, 2026
| @@ -0,0 +1,15 @@ | |||
| import packageJson from "./package.json" with { type: "json" }; | |||
| import modulePackage from "module"; | |||
Member
There was a problem hiding this comment.
Suggested change
| import modulePackage from "module"; |
Do we need this?
| res.write = function (chunk) { | ||
| resBody.push(chunk); | ||
|
|
||
| // @ts-ignore |
Member
There was a problem hiding this comment.
Some ts-ignores in here that we can probably get rid of
Comment on lines
52
to
56
| } | ||
| ); | ||
|
|
||
| // @ts-ignore | ||
| oldEnd.apply(res, arguments); | ||
| }; |
There was a problem hiding this comment.
Bug: The script request-logger-proxy.mjs uses the CommonJS-only global __dirname in an ES Module context, which will cause a ReferenceError at runtime.
Severity: HIGH
Suggested Fix
Define a __dirname constant at the top of the file using the standard pattern for ES Modules. For example: import path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename);
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/playground/scripts/request-logger-proxy.mjs#L52-L56
Potential issue: The file `packages/playground/scripts/request-logger-proxy.mjs` was
converted from a TypeScript file running in a CommonJS context to a native ES Module
(`.mjs`). However, it still uses the `__dirname` global variable inside the `res.end`
callback. `__dirname` is not available in ES Modules, which will cause a
`ReferenceError: __dirname is not defined` at runtime every time a proxied HTTP response
completes, breaking the request logging functionality.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Just stripping out stuff we've already removed from the JavaScript repository!