Skip to content

Commit

Permalink
fix(dev-server): rollback to bypass option
Browse files Browse the repository at this point in the history
bypass is deprecated in http-proxy-middleware but it's the only option working correctly with dev server
  • Loading branch information
Heymdall committed Jan 14, 2025
1 parent b785bba commit b7936df
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/arui-scripts/src/configs/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@ import { ENV_CONFIG_FILENAME } from './client-env-config';
const serverProxyConfig = {
context: ['/**'],
target: `http://127.0.0.1:${configs.serverPort}`,
router: (req: http.IncomingMessage) => {
bypass: (req: http.IncomingMessage) => {
const assetsRoot = path.normalize(`/${configs.publicPath}`).replace(/\\/g, '/');

if (req?.url?.startsWith(assetsRoot)) {
return req.url;
}

return {
protocol: 'http:',
host: '127.0.0.1',
port: configs.serverPort,
};
return null;
},
...(configs.devSourceMaps && configs.devSourceMaps.includes('eval') || configs.devServerCors
? {
Expand Down Expand Up @@ -68,7 +64,7 @@ const devServerConfig = applyOverrides('devServer', {
// создаваемый для client-only режима как раз такой. Так же работает и env-config.json
writeToDisk: (filename) => filename.endsWith('.html') || filename.endsWith(ENV_CONFIG_FILENAME),
},
static: [configs.serverOutputPath],
static: [configs.serverOutputPath, configs.clientOutputPath],
proxy: getProxyConfig(),
headers: configs.devServerCors
? {
Expand Down

0 comments on commit b7936df

Please sign in to comment.