Skip to content

Commit 974f137

Browse files
authored
Revert "fix(remix): Use import() to get react-router-dom in Express wrapper. (#5796)" (#5802)
This reverts commit 1f3da81.
1 parent de0f3e8 commit 974f137

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/remix/src/utils/serverAdapters/express.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { getCurrentHub } from '@sentry/hub';
22
import { flush } from '@sentry/node';
33
import { hasTracingEnabled } from '@sentry/tracing';
44
import { Transaction } from '@sentry/types';
5-
import { extractRequestData, isString, logger } from '@sentry/utils';
6-
import { cwd } from 'process';
5+
import { extractRequestData, isString, loadModule, logger } from '@sentry/utils';
76

87
import {
98
createRoutes,
@@ -19,6 +18,7 @@ import {
1918
ExpressRequest,
2019
ExpressRequestHandler,
2120
ExpressResponse,
21+
ReactRouterDomPkg,
2222
ServerBuild,
2323
} from '../types';
2424

@@ -27,8 +27,7 @@ function wrapExpressRequestHandler(
2727
build: ServerBuild,
2828
): ExpressRequestHandler {
2929
const routes = createRoutes(build.routes);
30-
// eslint-disable-next-line @typescript-eslint/no-var-requires
31-
const pkg = require(`${cwd()}/node_modules/react-router-dom`);
30+
const pkg = loadModule<ReactRouterDomPkg>('react-router-dom');
3231

3332
// If the core request handler is already wrapped, don't wrap Express handler which uses it.
3433
if (isRequestHandlerWrapped) {

0 commit comments

Comments
 (0)