File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1+ // @ts -check
2+
3+ import { readFileSync } from 'fs' ;
4+ import { dirname , join } from 'path' ;
5+ import { fileURLToPath } from 'url' ;
16import replace from '@rollup/plugin-replace' ;
27import { makeBaseNPMConfig , makeNPMConfigVariants } from '@sentry-internal/rollup-utils' ;
3- import packageJson from './package.json' with { type : 'json' } ;
8+
9+ const packageJson = JSON . parse ( readFileSync ( join ( dirname ( fileURLToPath ( import . meta. url ) ) , 'package.json' ) , 'utf-8' ) ) ;
10+
11+ if ( ! packageJson . version ) {
12+ throw new Error ( 'invariant: package version not found' ) ;
13+ }
14+
15+ const packageVersion = packageJson . version ;
416
517export default makeNPMConfigVariants (
618 makeBaseNPMConfig ( {
@@ -18,7 +30,7 @@ export default makeNPMConfigVariants(
1830 replace ( {
1931 preventAssignment : true ,
2032 values : {
21- __SENTRY_SDK_VERSION__ : JSON . stringify ( packageJson . version ) ,
33+ __SENTRY_SDK_VERSION__ : JSON . stringify ( packageVersion ) ,
2234 } ,
2335 } ) ,
2436 ] ,
You can’t perform that action at this time.
0 commit comments