-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6457 from marmelab/improve-examples-observability
[Demo] Improve learning experience by keeping component names in React DevTools
- Loading branch information
Showing
5 changed files
with
140 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Rewrite Webpack config without ejecting CRA thanks to rewire | ||
* @link https://stackoverflow.com/questions/55165466/how-to-build-a-production-version-of-react-without-minification | ||
*/ | ||
const rewire = require('rewire'); | ||
const defaults = rewire('react-scripts/scripts/build.js'); | ||
const config = defaults.__get__('config'); | ||
|
||
/** | ||
* Do not mangle component names in production, for better learning experience | ||
* @link https://kentcdodds.com/blog/profile-a-react-app-for-performance#disable-function-name-mangling | ||
*/ | ||
config.optimization.minimizer[0].options.terserOptions.keep_classnames = true; | ||
config.optimization.minimizer[0].options.terserOptions.keep_fnames = true; | ||
|
||
/** | ||
* Do not disable component profiling in production, for better learning experience | ||
* @link https://kentcdodds.com/blog/profile-a-react-app-for-performance#update-the-webpack-config-for-production-profiling | ||
*/ | ||
config.resolve.alias['react-dom$'] = 'react-dom/profiling'; | ||
config.resolve.alias['scheduler/tracing'] = 'scheduler/tracing-profiling'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Rewrite Webpack config without ejecting CRA thanks to rewire | ||
* @link https://stackoverflow.com/questions/55165466/how-to-build-a-production-version-of-react-without-minification | ||
*/ | ||
const rewire = require('rewire'); | ||
const defaults = rewire('react-scripts/scripts/build.js'); | ||
const config = defaults.__get__('config'); | ||
|
||
/** | ||
* Do not mangle component names in production, for better learning experience | ||
* @link https://kentcdodds.com/blog/profile-a-react-app-for-performance#disable-function-name-mangling | ||
*/ | ||
config.optimization.minimizer[0].options.terserOptions.keep_classnames = true; | ||
config.optimization.minimizer[0].options.terserOptions.keep_fnames = true; | ||
|
||
/** | ||
* Do not disable component profiling in production, for better learning experience | ||
* @link https://kentcdodds.com/blog/profile-a-react-app-for-performance#update-the-webpack-config-for-production-profiling | ||
*/ | ||
config.resolve.alias['react-dom$'] = 'react-dom/profiling'; | ||
config.resolve.alias['scheduler/tracing'] = 'scheduler/tracing-profiling'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters