Skip to content

Commit

Permalink
feat(plugin): add react-devtools to plugin bundle for standalone clie…
Browse files Browse the repository at this point in the history
…nt in iframe
  • Loading branch information
KaiVandivier committed May 8, 2024
1 parent 37c75e4 commit 5ce4e27
Show file tree
Hide file tree
Showing 3 changed files with 538 additions and 8 deletions.
10 changes: 9 additions & 1 deletion cli/config/plugin.webpack.config.js
Expand Up @@ -95,10 +95,18 @@ module.exports = ({ env: webpackEnv, config, paths }) => {
].filter(Boolean)
}

// DHIS2: in dev, add 'react-devtools' to the entry
// to enabled standalone React Dev Tools to work in iframes
// Intro: https://stackoverflow.com/a/71513012
// https://github.com/facebook/react/tree/main/packages/react-devtools#usage-with-react-dom
const resolvedEntry = isDevelopment
? ['react-devtools', paths.shellPluginBundleEntrypoint]
: paths.shellPluginBundleEntrypoint

return {
mode: webpackEnv,
bail: isProduction,
entry: paths.shellPluginBundleEntrypoint,
entry: resolvedEntry,
output: {
path: paths.shellBuildOutput,
filename: isProduction
Expand Down
1 change: 1 addition & 0 deletions cli/package.json
Expand Up @@ -61,6 +61,7 @@
"parse-gitignore": "^1.0.1",
"postcss-loader": "^7.0.1",
"react-dev-utils": "^12.0.0",
"react-devtools": "^5.2.0",
"react-refresh": "^0.11.0",
"style-loader": "^3.3.1",
"styled-jsx": "^4.0.1",
Expand Down

0 comments on commit 5ce4e27

Please sign in to comment.