diff --git a/app/javascript/Search/Search.jsx b/app/javascript/Search/Search.jsx
index eea0e21af..b3656b5c5 100644
--- a/app/javascript/Search/Search.jsx
+++ b/app/javascript/Search/Search.jsx
@@ -1,4 +1,3 @@
-import 'preact/devtools';
import { h, Component, Fragment } from 'preact';
import PropTypes from 'prop-types';
import {
diff --git a/app/javascript/Search/SearchForm.jsx b/app/javascript/Search/SearchForm.jsx
index 881f81baf..4db230205 100644
--- a/app/javascript/Search/SearchForm.jsx
+++ b/app/javascript/Search/SearchForm.jsx
@@ -1,4 +1,3 @@
-import 'preact/devtools';
import PropTypes from 'prop-types';
import { h } from 'preact';
diff --git a/app/javascript/onboarding/Onboarding.jsx b/app/javascript/onboarding/Onboarding.jsx
index 9a897ff40..fde0dd00b 100644
--- a/app/javascript/onboarding/Onboarding.jsx
+++ b/app/javascript/onboarding/Onboarding.jsx
@@ -1,4 +1,3 @@
-import 'preact/devtools';
import { h, Component } from 'preact';
import PropTypes from 'prop-types';
@@ -69,7 +68,18 @@ export default class Onboarding extends Component {
render() {
const { currentSlide } = this.state;
const { communityConfig } = this.props;
- return {this.slides[currentSlide]};
+ return (
+
+ {this.slides[currentSlide]}
+
+ );
}
}
@@ -78,6 +88,6 @@ Onboarding.propTypes = {
communityName: PropTypes.string.isRequired,
communityBackground: PropTypes.string.isRequired,
communityLogo: PropTypes.string.isRequired,
- communityDescription: PropTypes.string.isRequired
- }).isRequired
+ communityDescription: PropTypes.string.isRequired,
+ }).isRequired,
};
diff --git a/config/webpack/development.js b/config/webpack/development.js
index 0784f2e8d..71ed8e47e 100644
--- a/config/webpack/development.js
+++ b/config/webpack/development.js
@@ -8,4 +8,19 @@ const config = environment.toWebpackConfig();
// For more information, see https://webpack.js.org/configuration/devtool/#devtool
config.devtool = 'eval-source-map';
+// Inject the preact/devtools import into all the webpacker pack files (webpack entry points) that reference at least one Preact component
+// so that Preact compoonents can be debugged with the Preact DevTools.
+config.entry = Object.entries(config.entry).reduce(
+ (previous, [entryPointName, entryPointFileName]) => {
+ if (/\.jsx$/.test(entryPointFileName)) {
+ previous[entryPointName] = ['preact/devtools', entryPointFileName];
+ } else {
+ previous[entryPointName] = entryPointFileName;
+ }
+
+ return previous;
+ },
+ {},
+);
+
module.exports = config;
diff --git a/docs/frontend/debugging.md b/docs/frontend/debugging.md
index d3dcd8aa8..4a325f42c 100644
--- a/docs/frontend/debugging.md
+++ b/docs/frontend/debugging.md
@@ -48,5 +48,5 @@ If you do not see your editor here, consider contributing to the documentation.
Preact has their
[own developer tools](https://preactjs.github.io/preact-devtools/) in the form
-of a browser extension. These tools are currently supported for Preact version
-10.x and up. Forem currently uses Preact 10.x.
+of a browser extension. The Forem codebase is configured out of the box to
+support the Preact Devtools.