The React doc on Profiler says the following:
Pitfall
Profiling adds some additional overhead, so it is disabled in the production build by default. To opt into production profiling, you need to enable a special production build with profiling enabled.
In that Gist, there are comments like these:
- https://gist.github.com/bvaughn/25e6233aeb1b4f0cdb8d8366e54a3977?permalink_comment_id=4192069#gistcomment-4192069
which says:
In Vite putting this in
vite.config.ts
worked:
export default defineConfig({
// ...
resolve: {
alias: {
'react-dom': path.resolve(
__dirname,
'node_modules/react-dom/profiling'
),
'scheduler/tracing': path.resolve(
__dirname,
'node_modules/scheduler/tracing-profiling'
),
},
},
// ...
- https://gist.github.com/bvaughn/25e6233aeb1b4f0cdb8d8366e54a3977?permalink_comment_id=4989465#gistcomment-4989465
which says:
{
resolve: {
alias: [
{ find: /^react-dom$/, replacement: 'react-dom/profiling' },
{ find: 'scheduler/tracing', replacement: 'scheduler/tracing-profiling' }
]
}
}
in
vite.config.js
did the trick for me.
My question is: is any of these comments the recommended guidance, or is there another way of doing it?