Merge pull request #4172 from overleaf/ae-enable-react-dev-tools

Re-enable React Dev Tools

GitOrigin-RevId: 2757888b03997b9df55f1ef1a8fa0cca71cbcc78
This commit is contained in:
Jakob Ackermann 2021-06-10 12:01:49 +02:00 committed by Copybot
parent 3d5687a1f4
commit 10e7a919c0
2 changed files with 9 additions and 5 deletions

View file

@ -1,3 +1,4 @@
const webpack = require('webpack')
const merge = require('webpack-merge') const merge = require('webpack-merge')
const MiniCssExtractPlugin = require('mini-css-extract-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin')
@ -15,6 +16,14 @@ module.exports = merge(base, {
// Output to public/stylesheets directory // Output to public/stylesheets directory
filename: 'stylesheets/[name].css', filename: 'stylesheets/[name].css',
}), }),
// Disable React DevTools if DISABLE_REACT_DEVTOOLS is set to "true"
new webpack.DefinePlugin({
__REACT_DEVTOOLS_GLOBAL_HOOK__:
process.env.DISABLE_REACT_DEVTOOLS === 'true'
? '({ isDisabled: true })'
: undefined,
}),
], ],
devServer: { devServer: {

View file

@ -256,11 +256,6 @@ module.exports = {
writeToFileEmit: true, writeToFileEmit: true,
}), }),
// Silence react messages in the dev-tools console
new webpack.DefinePlugin({
__REACT_DEVTOOLS_GLOBAL_HOOK__: '({ isDisabled: true })',
}),
// Prevent moment from loading (very large) locale files that aren't used // Prevent moment from loading (very large) locale files that aren't used
new webpack.IgnorePlugin({ new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/, resourceRegExp: /^\.\/locale$/,