Skip to content

Instantly share code, notes, and snippets.

@woss
Last active September 26, 2022 15:33
Show Gist options
  • Save woss/3a877be99f1a49c9ea9e9fe9e55f1172 to your computer and use it in GitHub Desktop.
Save woss/3a877be99f1a49c9ea9e9fe9e55f1172 to your computer and use it in GitHub Desktop.
// enable this in docusaurus.config.js > plugins: [require('./plugins/gitpod')],
/**
* Docusaurus plugin to work with the gitpod and HMR
*/
module.exports = function () {
const { GITPOD_WORKSPACE_URL } = process.env;
return {
name: 'enable-hot-reload-for-gitpod',
configureWebpack(config, isServer) {
if (isServer) {
} else {
return {
devServer: {
...config.devServer,
compress: true,
port: 7777,
client: {
webSocketURL: GITPOD_WORKSPACE_URL
? GITPOD_WORKSPACE_URL.replace('https://', 'wss://7777-') + '/ws'
: `ws://localhost:7777/ws`,
},
},
};
}
},
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment