import { appTools, defineConfig } from "@modern-js/app-tools"; import { moduleFederationPlugin } from "@module-federation/modern-js"; const buildTarget = process.env["BUILD_TARGET"]; const isRemote = buildTarget === "remote"; const plugins = [ appTools({ bundler: "rspack" }), ...(isRemote ? [moduleFederationPlugin()] : []), ]; // Runtime env values that must reach the client bundle. Rspack resolves // `process.env` at BUILD time to an empty-ish polyfill in the browser, so // any value we want per-deployment (e.g. MAP_TILE_URL pointing at a tile // service that the local ingress doesn't proxy) has to be injected into // the HTML as a window global. getEnv() picks up window.__ENV__ on the // client. Evaluated once at Modern.js build time → pod env → HTML. // // IMPORTANT: Rspack's HTML plugin preprocesses