Skip to content

Instantly share code, notes, and snippets.

@DSchau
Last active September 26, 2019 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DSchau/f1a407f1ec3da036e1194065d84ecaec to your computer and use it in GitHub Desktop.
Save DSchau/f1a407f1ec3da036e1194065d84ecaec to your computer and use it in GitHub Desktop.
React Profiler for Gatsby
// HAVE NOT TESTED, BUYER BEWARE
/*
* Potential enhancements:
* disable mangling to see component names
* only do this with a certain env variable (e.g. PROFILE=true)?
*/
exports.onCreateWebpackConfig = ({
actions,
}) => {
actions.setWebpackConfig({
resolve: {
alias: {
'react-dom$': 'react-dom/profiling',
'scheduler/tracing': 'scheduler/tracing-profiling',
}
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment