Hello everyone.
I have been trying to make some modifications to the frontend-platform part of the MFEs so it will also support the Greek Language “el” (for the time being only a handful of languages are supported, I think just 14 of them), as, our platform runs in Greece in Greek language and without it we cannot keep up with the new Open Edx releases after tutor became the default installation method and MFEs are being used by default instead of the old django/mako templates in certain parts of the platform.
The changes needed to be made are minimal, just some minor additions to 3-4 files in the frontend-platform
library.
After I bindmounted the forked MFEs’ code (eg the Learning MFE to my tutor dev installation) and edited the frontend-platform
files directly inside the node_modules/@edx/frontend-platform
path where they were installed, the Greek language worked without problems, but it seems impossible to transfer the changes to our “tutor local” open edx installation which we’ll use for our production platform.
First, I tried to use the following tutorial from here:
https://github.com/openedx/frontend-build#local-module-configuration-for-webpack
So I forked the frontend-platform
to be able to make my tutor dev instalation use the forked one (so to edit its original code instead of the installed library inside node-modules/@edx/frontend-platform
of each MFE), but it didn’t work due to some errors ending up in ignoring my “module.config.js
” and using the locally installed frontend-platform
inside each MFE’s node_modules.
I did the test with frontend-app-learning
bindmounted to my tutor dev…
My “module.config.js
” content is this:
module.exports = { localModules: [ { moduleName: '@edx/frontend-platform', dir: '../src/frontend-platform', dist: 'dist' }, ], };
When I run “npm install && npm run build
” it appears to be completed with just some warnings, although one of them seems to contain an error:
WARNING in ./node_modules/react-responsive/dist/react-responsive.js Module Warning (from ./node_modules/source-map-loader/index.js): (Emitted value instead of an instance of Error) Cannot find source file 'webpack:///dist/react-responsive.js': Error: Can't resolve './webpack:///dist/react-responsive.js' in '/home/user/WORK/PEK/OPENEDXREPOS/TMP/frontend-app-learning/node_modules/react-responsive/dist' @ ./node_modules/@edx/paragon/dist/index.js 106:0-102 106:0-102 106:0-102 106:0-102 @ ./src/course-home/progress-tab/ProgressTab.jsx @ ./src/index.jsx 21:0-65 91:46-57
At the end I get this message: “webpack 5.50.0 compiled with 3 warnings in 29774 ms
”
Since it seems to not produce any errors I then try to mount the frontend-app-learning with “tutor dev start learning --mount=.
” but I get the error trace shown in the following file:
https://gist.github.com/dagg/46fe73a107ae4c2c3773a9cd5926e858
That wasn’t a big problem though since the changes I wanted to make were minimal so I thought of just making the changes to my forked frontend-platform
, pushing it to my github repo and then creating and enabling a tutor plugin with a “mfe-dockerfile-post-npm-install
” patch to make my “tutor local” open edx platform use frontend-platform
from my github repo instead of the original, following these steps from here:
https://github.com/overhangio/tutor-mfe#customising-mfes
My tutor plugin’s code is very simple as it’s shown here:
(it actually shows the path to the original frontent-platorm
by open edx but, before trying that, I used my own repo)
from tutor import hooks hooks.Filters.ENV_PATCHES.add_item( ( "mfe-dockerfile-post-npm-install", """ RUN npm install '@edx/frontend-platform@git+https://github.com/openedx/frontend-platform.git' """ ) )
This produced errors (when I used my own repo) and failed to even continue with the “tutor local quickstart
” installation.
The error trace is shown here:
https://gist.github.com/dagg/bfbfade3f53cee0f45f9650c5a266073
To eliminate the possibility that I had errors in my changes of the frontend-platform
library (since I could not test the changes before applying them to production for the reasons I explained firstly above), I tried to use the original repo of frontend-platform
from github (as shown on the plugin code I have quoted right above), but I kept getting the same errors, so it wasn’t my changes that produced the errors but the method of applying them to the platform.
I have even tried using the exact same examples as shown in the help, using the following in my plugin:
First I tried to aply the original frontend-component-header
from the npm repo:
RUN npm install '@edx/frontend-component-header@npm:@edx/frontend-component-header-edx@latest'
And then the frontend-component-footer
from its github repo:
RUN npm install '@edx/frontend-component-footer@git+https://github.com/edx/frontend-component-header-edx.git'
(Actually, there is an error I think in this step as it is shown in the help, the second part directs to the “frontend-component-header
” instead of the “frontend-component-footer
”, I believe this must be corrected. Although I tried both and none worked with similar errors)…
Again, the errors are shown in the following corresponding files:
https://gist.github.com/dagg/7a779d8ea86343870231448a5278d91d
https://gist.github.com/dagg/19d211fa51671a15f72cbfb5de8db262
Because it’s very important for us to be able to use the new releases in our native language, I would really appreciate some help on how to overcome those problems and also know if it’s something I am doing wrong or there is something wrong with the method of editing those components and applying them to the platform.
It would be very important and helpful for anyone who needs to make certain changes to the MFEs and their libraries, to be able to apply those changes to their production platform with ease and without such errors or too complicated steps.
For the record: I have no problem editing one or more of the actual MFEs (eg the Learning MFE) and applying them to the production platform (tutor local open edx installation) by changing the value which contains their source repo (eg: MFE_LEARNING_MFE_APP
).
To my knowledge so far, the problem appears only with such libraries as the “frontend-platform
” that are used by those MFEs and are installed inside each MFE’s node_modules.
Moreover, I can make a PR with my changes on the frontend-platform
for including the Greek language (el) but even if my PR will be accepted and included to following versions, I believe this would take time and I’d prefer for the time being a solution where I can apply these changes myself instead of waiting for the next releases, as it will be much harder to migrate our data from Lilac to the latest future open edx release.
The machine I am using for my tests has the following versions of tutor, docker, docker-compose, docker compose, in case they are of importance:
tutor, version 14.1.0
Docker version 20.10.21, build baeda1f
docker-compose version 1.29.2
Docker Compose version v2.6.0
Thank you in advance for any help on this matter! I hope it’s something trivial!