I did change AO’s settings to those in that (very good!) article. But the problem remained. FooGallery wouldn’t load when I was using GP but it did in Twenty Twenty.
But after a long chat with Frank, the boss over at Autoptimtize (who spent hours working with me on it last night, what a top man he is!) the problem was finally traced back to another plugin, Query Monitor.
It was changing the paths of two of your JS scripts.
When Query Monitor was removed, the site worked as expected.