Skip to content

Commit

Permalink
Include why-did-you-render in dev builds
Browse files Browse the repository at this point in the history
  • Loading branch information
tnajdek committed Jun 28, 2021
1 parent 29c36f2 commit 1937e1d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
35 changes: 28 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -85,6 +85,7 @@
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-replace": "^2.4.2",
"@rollup/plugin-wasm": "^5.1.2",
"@welldone-software/why-did-you-render": "^6.2.0",
"autoprefixer": "^10.2.6",
"babel-eslint": "^10.1.0",
"babelify": "^10.0.0",
Expand Down
1 change: 1 addition & 0 deletions rollup.config.js
Expand Up @@ -58,6 +58,7 @@ if(process.env.DEBUG) {

if(isProduction) {
config.plugins.push(terser());
config.external.push('./wdyr'); //exclude why-did-you-render from production
}

export default config;
1 change: 1 addition & 0 deletions src/js/main.js
@@ -1,3 +1,4 @@
import './wdyr';
import SmoothScroll from 'smooth-scroll';
import ZoteroBibComponent from './bib-component';

Expand Down
13 changes: 13 additions & 0 deletions src/js/wdyr.js
@@ -0,0 +1,13 @@
import React from 'react';
import whyDidYouRender from "@welldone-software/why-did-you-render";

if (process.env.NODE_ENV === 'development') {
whyDidYouRender(React, {
onlyLogs: true,
titleColor: '#957DAD',
diffNameColor: '#FFDFD3',
logOnDifferentValues: true,
// trackAllPureComponents: true,
});
console.warn('whyDidYouRender instal`led');
}

0 comments on commit 1937e1d

Please sign in to comment.