Skip to content

Commit

Permalink
Simplify telemetry Vite version detection (#7414)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Jun 19, 2023
1 parent 8f4a04d commit bb64483
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-candles-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Simplify telemetry Vite version detection
13 changes: 2 additions & 11 deletions packages/astro/src/events/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import { AstroTelemetry } from '@astrojs/telemetry';
import { createRequire } from 'module';
import { version as viteVersion } from 'vite';
import { ASTRO_VERSION } from '../core/constants.js';
const require = createRequire(import.meta.url);

function getViteVersion() {
try {
const { version } = require('vite/package.json');
return version;
} catch (e) {}
return undefined;
}

export const telemetry = new AstroTelemetry({
astroVersion: ASTRO_VERSION,
viteVersion: getViteVersion(),
viteVersion,
});

export * from './error.js';
Expand Down

0 comments on commit bb64483

Please sign in to comment.