Headless Magnolia - React component loading on index

54 views
Skip to first unread message

Matthieu Mestrez

unread,
Nov 28, 2023, 6:00:34 AM11/28/23
to Magnolia User Mailing List
Hi ! 

First of all some background, I'm working on app that was developped in magnolia 6.2.16, with a magnolia-headless-rendering 1.0.6 and inside, a React webapp that is constructed with node 16.13.0 on npm 8.1.0

One of the requirement, is to have the author deployed on the context root /author
There are for now two public instances, with just a login page, this login page is the React App

The problem with this setup, is that node/webpack creates an index.html page, with the path to the main.js (React compiled code) main.css and so on

This path is created with the help of PUBLIC_URL variable put on the environment
I managed to make it work by having two .war :
- Author, with the PUBLIC_URL : /author/.resources/login-module/webresources
- Public with PUBLIC_URL : /.resources/login-module/webresources


This will result in the correct path to the main.js in both cases, but one other requirement, is to have only one .war


So finally, my question : 

Do you think there is another way to tackle the problem ? How can I have only one deployable in both author and public instances, and I can see the React components in the author and the public instances alike ? 


Here are some solutions that I've tried and didn't work :
- putting the PUBLIC_URL to a relative path instead of absolute 
- removing the /author context on the deployable is not permitted
Reply all
Reply to author
Forward
0 new messages