Skip to content

Commit

Permalink
meta(utils): Don't use import assertion in rollup config (#14362)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst authored Nov 19, 2024
1 parent 4357b44 commit 100c662
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/utils/rollup.npm.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
// @ts-check

import { readFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import replace from '@rollup/plugin-replace';
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';
import packageJson from './package.json' with { type: 'json' };

const packageJson = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'package.json'), 'utf-8'));

if (!packageJson.version) {
throw new Error('invariant: package version not found');
}

const packageVersion = packageJson.version;

export default makeNPMConfigVariants(
makeBaseNPMConfig({
Expand All @@ -18,7 +30,7 @@ export default makeNPMConfigVariants(
replace({
preventAssignment: true,
values: {
__SENTRY_SDK_VERSION__: JSON.stringify(packageJson.version),
__SENTRY_SDK_VERSION__: JSON.stringify(packageVersion),
},
}),
],
Expand Down

0 comments on commit 100c662

Please sign in to comment.