From 01bb7d6ca9ec8a67e8729826188a2ec7fbe380b8 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Mon, 19 Aug 2024 01:15:42 +0200 Subject: [PATCH] correctly load assets when app not deployed in the root context of the server --- projects/rsbuild-ts/rsbuild.config.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/rsbuild-ts/rsbuild.config.ts b/projects/rsbuild-ts/rsbuild.config.ts index 8ab8318..31d62dc 100644 --- a/projects/rsbuild-ts/rsbuild.config.ts +++ b/projects/rsbuild-ts/rsbuild.config.ts @@ -5,6 +5,10 @@ export default defineConfig({ favicon: './assets/favicon-128x128.png', title: 'maxGraph Rsbuild TypeScript example', }, + output: { + // ensure assets are correctly loaded when the application is not at the root of the server, for examples when it is deployed on GitHub pages. + assetPrefix: 'auto', + } // enforce a chunk per module to better track the size of the maxGraph chunk. // We don't need it here because we have a single dependency, so the chunk automatically generated only includes the maxGraph module. // In addition, this also split chunks for the CSS files, which is not what we want (at least for now).