File tree Expand file tree Collapse file tree
packages/nextjs/src/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { parseSemver } from '@sentry/core' ;
22import * as fs from 'fs' ;
3- import { sync as resolveSync } from 'resolve ' ;
3+ import { createRequire } from 'module ' ;
44
55/**
66 * Returns the version of Next.js installed in the project, or undefined if it cannot be determined.
@@ -23,7 +23,7 @@ export function getNextjsVersion(): string | undefined {
2323
2424function resolveNextjsPackageJson ( ) : string | undefined {
2525 try {
26- return resolveSync ( 'next/package.json' , { basedir : process . cwd ( ) } ) ;
26+ return createRequire ( ` ${ process . cwd ( ) } /` ) . resolve ( 'next/package.json' ) ;
2727 } catch {
2828 return undefined ;
2929 }
Original file line number Diff line number Diff line change 33
44import { debug , escapeStringForRegex , loadModule , parseSemver } from '@sentry/core' ;
55import * as fs from 'fs' ;
6+ import { createRequire } from 'module' ;
67import * as path from 'path' ;
7- import { sync as resolveSync } from 'resolve' ;
88import type { VercelCronsConfig } from '../common/types' ;
99import { getBuildPluginOptions , normalizePathForGlob } from './getBuildPluginOptions' ;
1010import type { RouteManifest } from './manifest/types' ;
@@ -790,7 +790,7 @@ function addValueInjectionLoader({
790790
791791function resolveNextPackageDirFromDirectory ( basedir : string ) : string | undefined {
792792 try {
793- return path . dirname ( resolveSync ( 'next/package.json' , { basedir } ) ) ;
793+ return path . dirname ( createRequire ( ` ${ basedir } /` ) . resolve ( 'next/package.json' ) ) ;
794794 } catch {
795795 // Should not happen in theory
796796 return undefined ;
You can’t perform that action at this time.
0 commit comments