Skip to content

Instantly share code, notes, and snippets.

@justingrant
Created September 4, 2021 18:00
Show Gist options
  • Save justingrant/f8553e52ec9ce26f15009e73f54e609e to your computer and use it in GitHub Desktop.
Save justingrant/f8553e52ec9ce26f15009e73f54e609e to your computer and use it in GitHub Desktop.
Patch (using patch-package) for getting why-did-you-render to work with create-react-app V4
diff --git a/node_modules/babel-preset-react-app/create.js b/node_modules/babel-preset-react-app/create.js
index 99a930b..c898a12 100644
--- a/node_modules/babel-preset-react-app/create.js
+++ b/node_modules/babel-preset-react-app/create.js
@@ -96,7 +96,11 @@ module.exports = function (api, opts, env) {
// Will use the native built-in instead of trying to polyfill
// behavior for any plugins that require one.
...(opts.runtime !== 'automatic' ? { useBuiltIns: true } : {}),
- runtime: opts.runtime || 'classic',
+ // runtime: opts.runtime || 'classic',
+ // See https://github.com/welldone-software/why-did-you-render/issues/154#issuecomment-732711993
+ runtime: 'automatic',
+ development: process.env.NODE_ENV === 'development',
+ importSource: '@welldone-software/why-did-you-render',
},
],
isTypeScriptEnabled && [require('@babel/preset-typescript').default],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment