Local Proxy

Modern.js provides a way to configure the development proxy in dev.server.proxy.

For example, to proxy the local interface to another address:

modern.config.ts
import { defineConfig } from '@modern-js/app-tools';

export default defineConfig({
  dev: {
    server: {
      proxy: {
        // http://localhost:8080/api -> https://example.com/api
        // http://localhost:8080/api/foo -> https://example.com/api/foo
        '/api': 'https://example.com',
      },
    },
  },
});