Files
flights_web/modern.config.ts
T
gnezim 3f31ef591c Wire favicon via Modern.js html config
Angular's index.html referenced /assets/img/favicon.ico + a PNG icon +
an apple-touch-icon; the React port carried those assets through
config/public/ but never linked them in the HTML head, so the tab icon
was blank and /favicon.ico 404'd. Add html.favicon (copied to publicDir
root) plus html.tags for 16/32 PNG icons and apple-touch-icon.
2026-04-17 22:54:40 +03:00

79 lines
1.9 KiB
TypeScript

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()],
source: {
entriesDir: "./src",
},
html: {
favicon: "./config/public/favicon.ico",
tags: [
{
tag: "link",
attrs: {
rel: "icon",
type: "image/png",
sizes: "32x32",
href: "/assets/img/favicon-32x32.png",
},
},
{
tag: "link",
attrs: {
rel: "icon",
type: "image/png",
sizes: "16x16",
href: "/assets/img/favicon-16x16.png",
},
},
{
tag: "link",
attrs: {
rel: "apple-touch-icon",
href: "/assets/img/favicon-touch.png",
},
},
],
},
runtime: {
router: {
future: {
v7_startTransition: true,
v7_relativeSplatPath: true,
v7_fetcherPersist: true,
v7_normalizeFormMethod: true,
v7_partialHydration: true,
v7_skipActionErrorRevalidation: true,
},
},
},
server: {
ssr: {
mode: "stream",
},
},
tools: {
cssLoader: {
url: false,
},
// Explicit dev-server CORS headers. Silences the MF modern-js warning
// about empty devServer.headers (auto-assigning "*"). Production is
// unaffected — the real reverse proxy manages CORS.
devServer: {
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers":
"Content-Type, Authorization, Accept, Accept-Language",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
},
},
},
output: {
distPath: { root: isRemote ? "dist/remote" : "dist/standalone" },
},
});