Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
--- 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',
})
'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
You can’t perform that action at this time.