-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathindex.ts
More file actions
26 lines (22 loc) · 788 Bytes
/
index.ts
File metadata and controls
26 lines (22 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { SentryRollupPluginOptions } from "@sentry/rollup-plugin";
import { _rollupPluginInternal } from "@sentry/rollup-plugin";
import vite, { Plugin } from "vite";
function getViteMajorVersion(): string | undefined {
try {
// The version export was only added in Vite v3?
return vite?.version?.split(".")[0];
} catch (err) {
// do nothing, we'll just not report a version
}
return undefined;
}
export const sentryVitePlugin = (options?: SentryRollupPluginOptions): Plugin[] => {
return [
{
enforce: "pre",
..._rollupPluginInternal(options, "vite", getViteMajorVersion()),
},
];
};
export type { Options as SentryVitePluginOptions } from "@sentry/bundler-plugin-core";
export { sentryCliBinaryExists } from "@sentry/bundler-plugin-core";