Skip to content

Commit 7385de9

Browse files
author
Brian Vaughn
committed
react-devtools-core standalone bugfix: prevent electron crash
CSS source maps require the style-loader to use URL.createObjectURL (rather than just a <style> tag). For some reason, this crashes Electron's webview process, which completely breaks the embedded extension inside of Nuclide and other Electron apps. This commit turns (CSS) source maps off for production builds to avoid this crash.
1 parent 76c6739 commit 7385de9

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

packages/react-devtools-core/webpack.standalone.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ module.exports = {
5757
{
5858
loader: 'css-loader',
5959
options: {
60-
sourceMap: true,
60+
// WARNING It's important that we disable CSS source maps for production builds.
61+
// This causes style-loader to insert styles via a <style> tag rather than URL.createObjectURL,
62+
// which in turn avoids a nasty Electron/Chromium bug that breaks DevTools in Nuclide.
63+
// (Calls to URL.createObjectURL seem to crash the webview process.)
64+
sourceMap: __DEV__,
6165
modules: true,
6266
localIdentName: '[local]___[hash:base64:5]',
6367
},

shells/browser/shared/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module.exports = {
5959
{
6060
loader: 'css-loader',
6161
options: {
62-
sourceMap: true,
62+
sourceMap: __DEV__,
6363
modules: true,
6464
localIdentName: '[local]___[hash:base64:5]',
6565
},

shells/dev/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const config = {
5757
{
5858
loader: 'css-loader',
5959
options: {
60-
sourceMap: true,
60+
sourceMap: __DEV__,
6161
modules: true,
6262
localIdentName: '[local]___[hash:base64:5]',
6363
},

0 commit comments

Comments
 (0)