Skip to content

Commit 9beabc0

Browse files
committed
Use HOST and HTTPS variables to wrangle Webpack
Create React App doesn't provide a WDS_ env var to control https://github.com/webpack/webpack-dev-server/blob/540c43852ea33f9cb18820e1cef05d5ddb86cc3e/lib/Server.js#L562-L569 when it makes the config at https://github.com/facebook/create-react-app/blob/20edab4894b301f6b90dad0f90a2f82c52a7ac66/packages/react-scripts/config/webpackDevServer.config.js#L19-L22 So we have to actually put the server into HTTPS mode if we want WSS used for the hot reload server. Luckily, Github's proxy ignores self-signed certs. But we still need to set HOST or the proxy weirdly doesn't work with HTTPS ports. See https://github.com/orgs/community/discussions/28563#discussioncomment-4984423
1 parent 9c7cfe2 commit 9beabc0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"ghcr.io/devcontainers/features/git:1": {},
77
"ghcr.io/devcontainers-contrib/features/apt-get-packages:1": {"packages": "nano"},
88
"ghcr.io/devcontainers-contrib/features/bash-command:1": {
9-
"command": "echo aWYgW1sgISAteiAiJHtHSVRIVUJfQ09ERVNQQUNFU19QT1JUX0ZPUldBUkRJTkdfRE9NQUlOfSIgXV0gOyB0aGVuIGV4cG9ydCBXRFNfU09DS0VUX0hPU1Q9IiR7Q09ERVNQQUNFX05BTUV9LTMwMDEuJHtHSVRIVUJfQ09ERVNQQUNFU19QT1JUX0ZPUldBUkRJTkdfRE9NQUlOfSI7IGV4cG9ydCBXRFNfU09DS0VUX1BPUlQ9NDQzOyBmaQo= | base64 --decode >>/etc/bash.bashrc # Line to tell Webpack dev server to ignore HOST and use the Github Codespace port forward if we are in a Codespace. Need to base64 here because double quotes cannot be escaped through the devcontainer build process."
9+
"command": "echo aWYgW1sgISAteiAiJHtHSVRIVUJfQ09ERVNQQUNFU19QT1JUX0ZPUldBUkRJTkdfRE9NQUlOfSIgXV0gOyB0aGVuIGV4cG9ydCBXRFNfU09DS0VUX0hPU1Q9IiR7Q09ERVNQQUNFX05BTUV9LTMwMDEuJHtHSVRIVUJfQ09ERVNQQUNFU19QT1JUX0ZPUldBUkRJTkdfRE9NQUlOfSI7IGV4cG9ydCBXRFNfU09DS0VUX1BPUlQ9NDQzOyBleHBvcnQgSE9TVD0wLjAuMC4wOyBleHBvcnQgSFRUUFM9dHJ1ZTsgZmkK | base64 --decode >>/etc/bash.bashrc # Line to tell Webpack dev server to ignore HOST and use the Github Codespace port forward if we are in a Codespace. Need to base64 here because double quotes cannot be escaped through the devcontainer build process."
1010
}
1111
},
1212
"postCreateCommand": ". ${NVM_DIR}/nvm.sh && nvm install"

0 commit comments

Comments
 (0)