Last active
October 24, 2019 19:48
-
-
Save fivethreeo/48558e2bf0ec228af4b4763d4199df0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- webpackHotDevClient.orig.js 2019-10-24 21:33:25.464549772 +0200 | |
+++ webpackHotDevClient.js 2019-10-24 21:40:27.485125571 +0200 | |
@@ -22,7 +22,7 @@ | |
url.format({ | |
protocol: window.location.protocol, | |
hostname: window.location.hostname, | |
- port: parseInt(process.env.PORT || window.location.port, 10) + 1, | |
+ port: process.env.RAZZLE_HOTCLIENT_NOPORT ? '' : parseInt(process.env.PORT || window.location.port, 10) + 1, | |
pathname: launchEditorEndpoint, | |
search: | |
'?fileName=' + | |
@@ -62,7 +62,7 @@ | |
url.format({ | |
protocol: window.location.protocol, | |
hostname: window.location.hostname, | |
- port: parseInt(process.env.PORT || window.location.port, 10) + 1, | |
+ port: process.env.RAZZLE_HOTCLIENT_NOPORT ? '' : parseInt(process.env.PORT || window.location.port, 10) + 1, | |
// Hardcoded in WebpackDevServer | |
pathname: '/sockjs-node', | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = { | |
modify: (defaultConfig, { target, dev }, webpack) => { | |
const config = defaultConfig; | |
if (dev) { | |
if (target === 'web') { | |
config.devServer.quiet = false; | |
config.devServer.public = 'localhost:443'; | |
} | |
config.module.rules = config.module.rules.reduce((rules, rule) => { | |
if (rule.test && | |
rule.test.toString()===/\.(js|jsx|mjs)$/.toString() && | |
!rule.enforce) { | |
const { use, ...rest } = rule; | |
rules.push({ ...rule, ...{ | |
exclude: /razzle-dev-utils\/webpackHotDevClient\.js/ | |
}}); | |
// yarn add patch-loader | |
// Use env var RAZZLE_HOTCLIENT_NOPORT=true | |
rules.push({ ...rest, ...{ | |
use: [ ...use, { | |
loader: require.resolve('patch-loader'), | |
options: { patch: '../../customDevClientPort.diff' }, | |
}], | |
include: /razzle-dev-utils\/webpackHotDevClient\.js/, | |
}}); | |
} | |
else { | |
rules.push(rule); | |
} | |
return rules; | |
}, []); | |
} | |
return config; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment