web-infra-dev/modern.js

[Bug]: can't configure sentry

Opened this issue ยท 2 comments

Version

System:
    OS: macOS 12.5.1
    CPU: (8) arm64 Apple M1
    Memory: 100.83 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Browsers:
    Brave Browser: 127.1.68.134
    Chrome: 129.0.6668.60
    Safari: 15.6.1
  npmPackages:
    @modern-js/app-tools: 2.59.0 => 2.59.0 
    @modern-js/runtime: 2.60.0 => 2.60.0

Details

I'm trying to implement sentry and I can't find a way to override/customize the createBrowserRouter function.

image

https://docs.sentry.io/platforms/javascript/guides/react/features/react-router/

I was reviewing the docs but didn't find something I can use to override that. I found this but looks like this is not the way to do that: https://modernjs.dev/en/apis/app/hooks/src/app.html

Maybe there are a doc or config that I'm missing? ๐Ÿ™๐Ÿผ

Reproduce link

Reproduce Steps

you want override createBrowserRouter ? maybe you can use alias for react-router-dom hh

hi @zllkjc

Yes! basically I want to do this:

const sentryCreateBrowserRouter = Sentry.wrapCreateBrowserRouter(
  createBrowserRouter,
);


// then use sentryCreateBrowserRouter instead if the createBrowserRouter function
const router = sentryCreateBrowserRouter([
  // here would be the autogenerated routes by modernjs
]);

Is it possible with aliases? ๐Ÿค” ๐Ÿ™๐Ÿผ