web-infra-dev / modern.js

Modern.js is a web engineering system, including a web framework and a npm package solution.
https://modernjs.dev/en/
MIT License
4.42k stars 367 forks source link

[Bug]: can't configure sentry #6288

Open GiancarlosIO opened 3 weeks ago

GiancarlosIO commented 3 weeks ago

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

-

zllkjc commented 1 week ago

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

GiancarlosIO commented 1 week ago

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? 🤔 🙏🏼