Skip to content

Commit

Permalink
Require TARGET_ELECTRON to be 'true' to be enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
heyimalex authored and danielmahon committed Jul 5, 2019
1 parent c020acb commit 75d6580
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,20 +663,22 @@ module.exports = function(webpackEnv) {
].filter(Boolean),
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
node: process.env.TARGET_ELECTRON
? undefined
: {
module: 'empty',
dgram: 'empty',
dns: 'mock',
fs: 'empty',
http2: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
},
node:
process.env.TARGET_ELECTRON === 'true'
? undefined
: {
module: 'empty',
dgram: 'empty',
dns: 'mock',
fs: 'empty',
http2: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
},
// Support electron-renderer target via environmental flag, default to web
target: process.env.TARGET_ELECTRON ? 'electron-renderer' : 'web',
target:
process.env.TARGET_ELECTRON === 'true' ? 'electron-renderer' : 'web',
// Turn off performance processing because we utilize
// our own hints via the FileSizeReporter
performance: false,
Expand Down

0 comments on commit 75d6580

Please sign in to comment.