Skip to content

Commit

Permalink
angular: replace proxy.conf.json with proxy.config.mjs (#28336)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored Jan 8, 2025
1 parent a862a1c commit 2243f1b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
2 changes: 1 addition & 1 deletion generators/angular/files-angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const files = {
condition: ctx => ctx.clientBundlerExperimentalEsbuild,
templates: [
{ sourceFile: 'angular.json.esbuild', destinationFile: 'angular.json' },
'proxy.conf.json',
'proxy.config.mjs',
'build-plugins/define-esbuild.mjs',
],
}),
Expand Down
2 changes: 1 addition & 1 deletion generators/angular/templates/angular.json.esbuild.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"options": {
"buildTarget": "<%= dasherizedBaseName %>:build:development",
"open": true,
"proxyConfig": "proxy.conf.json",
"proxyConfig": "proxy.config.mjs",
"port": <%= devServerPort %>
},
"configurations": {
Expand Down
27 changes: 0 additions & 27 deletions generators/angular/templates/proxy.conf.json.ejs

This file was deleted.

24 changes: 24 additions & 0 deletions generators/angular/templates/proxy.config.mjs.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const backendHost = '127.0.0.1';
const backendPort = <%= applicationTypeMicroservice ? gatewayServerPort : serverPort %>;

<%_ if (clientBundlerExperimentalEsbuild) { _%>
/**
* @type {import('vite').CommonServerOptions['proxy']}
*/
<%_ } _%>
export default {
<%_ if (communicationSpringWebsocket) { _%>
'/websocket': {
target: `ws://${backendHost}:${backendPort}`,
ws: true,
},
<%_ } _%>
'^/(api|management|v3/api-docs<% if (databaseTypeSql && devDatabaseTypeH2Any) { %>|h2-console<% } %><% if (authenticationTypeOauth2) { %>|oauth2|login<% } %><% if (authenticationTypeSession) { %>|login<% } %><% if (applicationTypeGateway || applicationTypeMicroservice) { %>|services<% } %>)': {
<%_ if (clientBundlerExperimentalEsbuild) { _%>
target: `http://${backendHost}:${backendPort}`,
<%_ } else { _%>
router: req => `http${req.socket.ssl ? 's' : ''}://${backendHost}:${backendPort}`,
<%_ } _%>
xfwd: true,
},
};

0 comments on commit 2243f1b

Please sign in to comment.