I'm building a module loading architecture on top of Liferay Portal based on webpack federation.
Since portal's have the concept of logged in user and each user has a preferred locale, I need to request JavaScript files with an extra parameter named languageId
which equates to the locale code (for example: en_US
). This is because a server side filter processes the .js
files based on that parameter.
Looking at the code generated by webpack I can only think of two places where this could be done:
- https://github.com/webpack/webpack/blob/master/lib/runtime/GetChunkFilenameRuntimeModule.js
- https://github.com/webpack/webpack/blob/master/lib/runtime/LoadScriptRuntimeModule.js
However, it doesn't seem that these two files could be configured to let me add that parameter to the request.
Also, I can't think of any tweak I could do at runtime to transform the URLs (thinking about a callback or something like that).
What would be the best way to achieve this if there's any?
If there's no way to do it, does it sound like a feature webpack should have?
Thanks in advance.