Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/migration/draft-v9-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- Deprecated `getNumberOfUrlSegments`. No replacements.
- Deprecated `BAGGAGE_HEADER_NAME`. No replacements.
- Deprecated `makeFifoCache`. No replacements.
- Deprecated `dynamicRequire`. No replacements.
- Deprecated `flatten`. No replacements.

## `@sentry/core`
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/utils-hoist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export {
parseSemver,
uuid4,
} from './misc';
// eslint-disable-next-line deprecation/deprecation
export { dynamicRequire, isNodeEnv, loadModule } from './node';
export { normalize, normalizeToSize, normalizeUrlToBase } from './normalize';
export {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/utils-hoist/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function isNodeEnv(): boolean {
* Requires a module which is protected against bundler minification.
*
* @param request The module path to resolve
* @deprecated This function will be removed in the next major version.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function dynamicRequire(mod: any, request: string): any {
Expand All @@ -47,14 +48,17 @@ export function loadModule<T>(moduleName: string): T | undefined {
let mod: T | undefined;

try {
// eslint-disable-next-line deprecation/deprecation
mod = dynamicRequire(module, moduleName);
} catch (e) {
// no-empty
}

if (!mod) {
try {
// eslint-disable-next-line deprecation/deprecation
const { cwd } = dynamicRequire(module, 'process');
// eslint-disable-next-line deprecation/deprecation
mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`) as T;
} catch (e) {
// no-empty
Expand Down
1 change: 1 addition & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ export const browserPerformanceTimeOrigin = browserPerformanceTimeOrigin_importe
export const supportsHistory = supportsHistory_imported;

/** @deprecated Import from `@sentry/core` instead. */
// eslint-disable-next-line deprecation/deprecation
export const dynamicRequire = dynamicRequire_imported;

/** @deprecated Import from `@sentry/core` instead. */
Expand Down
Loading