Files
dagu/ui/webpack.dev.js
Yota Hamada 3d87eb87d7 fix: proxy API requests in dev server to prevent HTTP/1.1 connection exhaustion
The dev setup used cross-origin requests (8081→8080) which required CORS
preflights for every fetch with Authorization headers. Combined with
long-lived SSE connections, this exhausted Chrome's 6-connection-per-origin
HTTP/1.1 limit, causing API requests to hang indefinitely when opening
the Spec tab in the DAG details panel.

Add webpack dev server proxy for /api routes and switch apiURL to a
relative path so all requests are same-origin, eliminating CORS
preflights and connection pool fragmentation.
2026-03-12 00:15:32 +09:00

78 lines
1.7 KiB
JavaScript

const HtmlWebpackPlugin = require('html-webpack-plugin');
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = merge(common, {
mode: 'development',
devtool: 'eval-source-map',
profile: true,
devServer: {
historyApiFallback: true,
port: 8081,
proxy: [
{
context: ['/api'],
target: 'http://localhost:8080',
changeOrigin: true,
ws: true,
},
],
client: {
overlay: {
runtimeErrors: (error) => {
// Ignore ResizeObserver errors - they're benign and common with Monaco Editor
if (error.message?.includes('ResizeObserver loop')) {
return false;
}
return true;
},
},
},
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'esbuild-loader',
options: {
loader: 'tsx',
target: 'es2015',
},
},
],
include: path.resolve(__dirname, 'src'),
exclude: path.resolve(__dirname, 'node_modules'),
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.html',
}),
new CopyWebpackPlugin({
patterns: [
{
from: 'favicon.ico',
to: 'assets/favicon.ico',
},
],
}),
],
optimization: {
removeAvailableModules: false,
removeEmptyChunks: false,
splitChunks: false,
},
output: {
filename: 'bundle.js',
pathinfo: false,
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
clean: true,
},
});