Skip to content

Commit

Permalink
changes proxy config to allow proxying of SSE
Browse files Browse the repository at this point in the history
  • Loading branch information
pmhsfelix committed Dec 2, 2024
1 parent 0ca6d22 commit 6c47d0e
Showing 1 changed file with 39 additions and 19 deletions.
58 changes: 39 additions & 19 deletions code/js/react-intro/webpack.dev.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
import { server } from "typescript";
import { server } from 'typescript';

export default {
mode: 'development',
devServer: {
historyApiFallback: true,
port: 3000,
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
},
plugins: [],
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
mode: 'development',
devServer: {
historyApiFallback: true,
port: 3000,
compress: false,
proxy: [
{
context: ['/api'],
target: 'http://localhost:8180',
onProxyRes: (proxyRes, req, res) => {
console.log('onProxyRes');
proxyRes.on('close', () => {
console.log('on proxyRes close');
if (!res.writableEnded) {
res.end();
}
});
res.on('close', () => {
console.log('on res close');
proxyRes.destroy();
});
},
],
},
};
},
],
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
},
plugins: [],
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
};

0 comments on commit 6c47d0e

Please sign in to comment.