Skip to content

Commit

Permalink
Remove HRM causing codespace to not load samples correctly (#5602)
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardlee-msft authored Jan 31, 2025
1 parent 72b4f8b commit b2e9bd9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
25 changes: 2 additions & 23 deletions common/config/webpack/sampleapp.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
const CopyPlugin = require("copy-webpack-plugin");
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const ReactRefreshTypeScript = require('react-refresh-typescript');

// Detect if running in GitHub Codespaces environment through environment variable set by codespace.
// More details: https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables
const RUNNING_IN_GH_CODESPACES = !!process.env.CODESPACES;

const webpackConfig = (sampleAppDir, env, babelConfig) => {
const config = {
Expand Down Expand Up @@ -52,12 +46,7 @@ const webpackConfig = (sampleAppDir, env, babelConfig) => {
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
transpileOnly: true,

// Enable HRML for GH codespaces devlopment (this was found to not work on MacOS so enabling for GH Codespaces only)
getCustomTransformers: () => ({
before: [!env.production && RUNNING_IN_GH_CODESPACES && ReactRefreshTypeScript()].filter(Boolean),
})
transpileOnly: true
},
exclude: /dist/,
sideEffects: false
Expand All @@ -77,9 +66,6 @@ const webpackConfig = (sampleAppDir, env, babelConfig) => {
]
},
plugins: [
// Enable HRML for GH codespaces devlopment (this was found to not work on MacOS so enabling for GH Codespaces only)
!env.production && RUNNING_IN_GH_CODESPACES && new ReactRefreshWebpackPlugin(),

new HtmlWebpackPlugin({ template: './public/index.html' }),
new webpack.DefinePlugin({
'process.env.PRODUCTION': env.production || !env.development,
Expand All @@ -100,19 +86,12 @@ const webpackConfig = (sampleAppDir, env, babelConfig) => {
{ from: path.resolve(sampleAppDir, "public/assets"), to: "assets", noErrorOnMissing: true },
]
})
].filter(Boolean),
],
devServer: {
port: 3000,
hot: true,
open: true,
static: { directory: path.resolve(sampleAppDir, 'public') },
// To support hot reloading in GitHub Codespaces, we need to use the secure websocket URL
// For more details: https://github.com/orgs/community/discussions/11524#discussioncomment-2176952
client: RUNNING_IN_GH_CODESPACES ? {
webSocketURL: {
port: '443'
}
} : undefined,
proxy: [
{
path: '/token',
Expand Down
3 changes: 0 additions & 3 deletions samples/Server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"@azure/communication-rooms": "1.1.0-beta.1 || ^1.1.0"
},
"devDependencies": {
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.13",
"@types/copy-webpack-plugin": "^6.4.0",
"@types/express": "^4.17.8",
"@types/http-errors": "^1.8.0",
Expand All @@ -63,8 +62,6 @@
"jest-junit": "^16.0.0",
"prettier": "3.3.2",
"pretty-quick": "^4.0.0",
"react-refresh": "^0.14.2",
"react-refresh-typescript": "^2.0.9",
"rimraf": "^2.6.2",
"supertest": "^6.3.3",
"ts-jest": "^29.1.5",
Expand Down

0 comments on commit b2e9bd9

Please sign in to comment.