From 4fd7ae3f944c3c4e93dcccc3947518e02e6330e5 Mon Sep 17 00:00:00 2001 From: gnezim Date: Tue, 14 Apr 2026 22:37:12 +0300 Subject: [PATCH] Add modern.config.ts with standalone/remote BUILD_TARGET branching --- modern.config.ts | 13 +++++++++++++ tsconfig.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 modern.config.ts diff --git a/modern.config.ts b/modern.config.ts new file mode 100644 index 00000000..f0d308d1 --- /dev/null +++ b/modern.config.ts @@ -0,0 +1,13 @@ +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"; + +export default defineConfig({ + plugins: [appTools({ bundler: "rspack" }), moduleFederationPlugin()], + server: isRemote ? {} : { ssr: { mode: "stream" } }, + output: { + distPath: { root: isRemote ? "dist/remote" : "dist/standalone" }, + }, +}); diff --git a/tsconfig.json b/tsconfig.json index 4e23b775..76b65f0f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,6 +25,6 @@ }, "types": ["node", "vitest/globals"] }, - "include": ["src/**/*.ts", "src/**/*.tsx", "vitest.config.ts"], + "include": ["src/**/*.ts", "src/**/*.tsx", "vitest.config.ts", "modern.config.ts", "module-federation.config.ts"], "exclude": ["node_modules", "dist", "ClientApp", "wwwroot"] }