Open amenk opened 5 years ago
We just have to set the config scope in backend to store_view level ...
When setting via magerun it's already working
Its working now Alex?
I was just setting the config via Magerun... the system.xml still needs to be adapted -- did not yet have time for that, and wanted to check first if it is working generally (which it does)
When I have time I will take a look on that also, thanks for the report
I have one big problem: The whole idea of having requireJS disabled on store view level does not work well on production mode ... the requireJS disabled on store view level does not work. It just stays enabled. When I switch to developer mode, it works.
Do you have any idea?
Somehow I cannot reproduce it anymore.
What I figured out is, that there is one requirejs-config per theme + language combination. While it does not make sense to exclude require js config per language, it also shows that my original approach is wrong -- to exclude requirejs per store view. Somehow we should make the config theme-dependent not store-view-dependent.
Okay, I still hat developer
mode set in my Apache Vhost. I can reproduce the problem now
Possible Fix:
But we cannot just add config to the theme XML ---> so other option would be a configuration table in the backend where you can map themes to configurations.
I merged your changes Alex, I will do some testing asp
Alex I think I found the problem why it doesn't work on production mode, I just don't know how to solve it yet.
At\Magento\RequireJs\Model\FileManager
the getFiles function is used but a check is made to see the current mode:
private function ensureSourceFile($relPath)
{
$dir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
if ($this->appState->getMode() == AppState::MODE_DEVELOPER || !$dir->isExist($relPath)) {
$dir->writeFile($relPath, $this->config->getConfig());
}
}
If I remove this check the requirejs breaks on frontend and backend, any ideas?
For me it was working in production mode after my PR... The important part is, that reauireJS modules can be only disabled on per-theme basis, because the rewuireJs config is statically generated once per theme, not per store view
Did you test my PR in production mode and still encounter problems?
I tested in production mode and magento2.3, I will do a new installation and check..
I am still not super with my approach -- would be better if requirejs could be disabled on a store view level. Still looking for a best practice.
I tested your changes with Magneto2.2 and 2.3 and seems to work fine
Which was the whole point :-)
Can it be fixed?
Will look at it ...