From f685bdca049cec3748c9916452ef5c075d0f4984 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Mon, 26 Jan 2026 20:20:44 +0000 Subject: [PATCH] Fix port for real --- frontend/webpack.config.js | 89 ++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js index a2a1872..15b9889 100644 --- a/frontend/webpack.config.js +++ b/frontend/webpack.config.js @@ -1,44 +1,57 @@ const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); -module.exports = { - entry: './src/index.tsx', - output: { - path: path.resolve(__dirname, 'dist'), - filename: 'bundle.js', - clean: true, - publicPath: './', - }, - resolve: { - extensions: ['.ts', '.tsx', '.js', '.jsx'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - exclude: /node_modules/, - use: 'ts-loader', - }, - { - test: /\.css$/, - use: ['style-loader', 'css-loader', 'postcss-loader'], - }, +module.exports = (env, argv) => { + const isProduction = argv.mode === 'production'; + + return { + entry: './src/index.tsx', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'bundle.js', + clean: true, + + // Empty string generates relative paths that work through proxies + publicPath: '', + }, + resolve: { + extensions: ['.ts', '.tsx', '.js', '.jsx'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: 'ts-loader', + }, + { + test: /\.css$/, + use: ['style-loader', 'css-loader', 'postcss-loader'], + }, + ], + }, + plugins: [ + new HtmlWebpackPlugin({ + template: './src/index.html', + }), ], - }, - plugins: [ - new HtmlWebpackPlugin({ - template: './src/index.html', - }), - ], - devServer: { - port: 3000, - allowedHosts: 'all', - historyApiFallback: true, - proxy: [ - { - context: ['/api'], - target: 'http://localhost:8001', + devServer: { + port: 3000, + allowedHosts: 'all', + historyApiFallback: { + index: 'index.html', }, - ], - }, + // Disable WebSocket-based HMR for proxy compatibility + // VS Code web proxy sends WebSocket messages as Blobs which breaks HMR + webSocketServer: false, + hot: false, + liveReload: false, + proxy: [ + { + context: ['/api'], + target: 'http://localhost:8001', + }, + ], + }, + }; };