Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

@sentry/cloudflare/vite: Add a default export for the Vite plugin

未关闭
#24,526 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@JPeer264 已经在做这个了。

开始于 2026年9月20日。

评估

这个 Issue 还没有评估数据。

描述

Cloudflare Workers Feature
Description

Add a default export to the @sentry/cloudflare/vite subpath, as an alias of sentryCloudflareVitePlugin, so the plugin can be imported under any name:

// vite.config.ts
import { cloudflare } from '@cloudflare/vite-plugin';
import sentry from '@sentry/cloudflare/vite';
import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [cloudflare(), sentry()],
});

sentryCloudflareVitePlugin stays the documented name, so this is additive and breaks nothing.

// packages/cloudflare/src/vite/index.ts
export default sentryCloudflareVitePlugin;
Why
  • Most Vite plugins default-export, for example @vitejs/plugin-react, vinext and nitro/vite. A default export matches what users expect at that place in the config.
  • The call site reads better with a short local name: plugins: [cloudflare(), sentry()].
  • There is precedent in this repo: @sentry/astro default-exports its integration, and @sentry/nuxt its module.
Notes
  • The ./vite subpath currently also declares a require condition. In CJS, a default export is reached as require('@sentry/cloudflare/vite').default. The comment at the top of src/vite/index.ts says the CJS entry cannot resolve anyway (@sentry/server-utils/orchestrion/vite has no require condition), and Vite configs are ESM in practice, so this is acceptable.
  • Sentry's other Vite plugins (@sentry/vite-plugin, SvelteKit, SolidStart) use named exports only, so this makes the Cloudflare one the exception. The named export stays, and docs keep using it.
  • The subpath exports more than the plugin (the options type today), so the JSDoc on the default export should state that it is an alias of sentryCloudflareVitePlugin.
Scope
  • export default sentryCloudflareVitePlugin; in packages/cloudflare/src/vite/index.ts, with JSDoc.
  • A test asserting the default export is the same function as the named one.
  • Optionally a docs snippet showing the short import.
主要语言
TypeScript
星标
8.7k
派生
1.9k
平均合并
1 天 16 小时
30 天内合并 PR
576

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getsentry/sentry-javascript 的其他 Issue

查看 getsentry/sentry-javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。