Uh oh!
There was an error while loading. Please reload this page.
chore: Remove ts-node usage - #931
Conversation
Uh oh!
There was an error while loading. Please reload this page.
| @@ -0,0 +1,15 @@ | |||
| import packageJson from "./package.json" with { type: "json" }; | |||
| import modulePackage from "module"; | |||
There was a problem hiding this comment.
| import modulePackage from "module"; |
Do we need this?
| res.write = function (chunk) { | ||
| resBody.push(chunk); | ||
| // @ts-ignore |
There was a problem hiding this comment.
Some ts-ignores in here that we can probably get rid of
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| ); | ||
| // @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.
| datasource | package | from | to | | ---------- | ------------------- | ----- | ----- | | npm | @sentry/vite-plugin | 5.3.0 | 5.4.0 | ## [v5.4.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#540) ##### Important Changes ✨ The Sentry bundler plugins are moving to our main [`sentry-javascript`](https://github.com/getsentry/sentry-javascript) monorepo and will be bumped to version `11.0.0` with the next SDK major release. In preparation, we've already ported the `@sentry/bundler-plugin-core` and `sentry/babel-plugin-component-annotate` packages, which are now merged and called `@@sentry/bundler-plugins`. If you're using any of our bundler plugins (e.g. `@sentry/vite-plugin`), nothing will change for you at the moment. If you encounter any problems, please open an issue in [`getsentry/sentry-javascript`](https://github.com/getsentry/sentry-javascript) going forward. Thank you! This repo will be closed after the v11 bump. Related PRs: - Depend on JavaScript repo package. by [@timfish](https://github.com/timfish) in [#945](getsentry/sentry-javascript-bundler-plugins#945) - Add `@sentry/bundler-plugins` core package by [@timfish](https://github.com/timfish) in [#938](getsentry/sentry-javascript-bundler-plugins#938) - Remove obsolete packages by [@timfish](https://github.com/timfish) in [#947](getsentry/sentry-javascript-bundler-plugins#947) ##### Bug Fixes 🐛 - (webpack) Make `webpack` import lazy to support rspack-only projects by [@s1gr1d](https://github.com/s1gr1d) in [#940](getsentry/sentry-javascript-bundler-plugins#940) - Hide console window when running 'git rev-parse HEAD' on Windows by [@jwwisgerhof](https://github.com/jwwisgerhof) in [#941](getsentry/sentry-javascript-bundler-plugins#941) ##### Internal Changes 🔧 - Update Sentry SDK for telemetry by [@timfish](https://github.com/timfish) in [#937](getsentry/sentry-javascript-bundler-plugins#937) - (sentry-cli) Upgrade to 2.58.6 by [@szokeasaurusrex](https://github.com/szokeasaurusrex) in [#936](getsentry/sentry-javascript-bundler-plugins#936) - Remove versions from telemetry snapshots by [@timfish](https://github.com/timfish) in [#946](getsentry/sentry-javascript-bundler-plugins#946) - Align lint configuration with JavaScript repo by [@timfish](https://github.com/timfish) in [#933](getsentry/sentry-javascript-bundler-plugins#933) - Align TypeScript configuration with JavaScript repo by [@timfish](https://github.com/timfish) in [#932](getsentry/sentry-javascript-bundler-plugins#932) - Fix CI caching on Windows by [@timfish](https://github.com/timfish) in [#934](getsentry/sentry-javascript-bundler-plugins#934) - Remove `ts-node` usage by [@timfish](https://github.com/timfish) in [#931](getsentry/sentry-javascript-bundler-plugins#931)
Just stripping out stuff we've already removed from the JavaScript repository!