Combining JS files in WP Rocket

Home Forums MapPress Support Combining JS files in WP Rocket

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #19664

    Sorry to ask for spoon-feeding, Chris, but I’ve tried on a few sites/occasions to exclude MapPress and Google API when combining scripts in WP Rocket and have not had success.  I’ve had to turn off combining JS altogether and accept the hit on performance.

    Excluding scripts is addressed generally in the FAQ but do you know *exactly* what works in the “Excluded JS Files” field in WP Rocket?

    This does not:*).js

    Nor anything I’ve tried to capture these from the FAQ (and I think the /build/ script file names have been updated?)

    Thanks in advance for any help!



    I don’t use WP Rocket, so I don’t know exactly how to prevent it from mangling scripts, but I can tell you all the MapPress JS files that may be used in the frontend.

    Have you tried switching on the iframes option in the MapPress settings?  That might also work.

    MapPress itself only has 1 file.  Note that it’s “index_mappress” not mappress_index“:

    The google clustering library is included with the plugin, and it’s loaded if you use clustering:

    The Leaflet engine and clustering are loaded from unpkg, if you use Leaflet:



    I’m having issues again with WP Rocket combining js files, although I’m pretty sure this issue was solved earlier.

    I excluded scripts and the plugin’s js files (and used WP Rocket’s recommended test to exclude all inline strings) but no maps display and this error in console: “React is not defined”.

    As a longshot I tried also excluding element.js and element.min.js in /wp-includes/js/dist/ but no joy.

    Does “React is not defined” provide a clue as to what needs to be added to the list of excluded scripts?

    Thanks again in advance for any help!



    This might be a question for the Rocket folks rather than me, but MapPress includes the WordPress React module and translation module (and those then include some other libraries). The complete list is: ‘wp-blocks’, ‘wp-components’, ‘wp-compose’, ‘wp-core-data’, ‘wp-element’, ‘wp-media-utils’, ‘wp-i18n’, ‘wp-notices’, ‘wp-url’.

    If you look at the page source for script tags you can see the JS being loaded (just deactivate ALL other plugins for a moment first). Here’s what I saw when I tried it. You probably want to exclude at least ‘react.min.js’.

    <script src="http://localhost/dev/wp-content/plugins/gutenberg/build/interactivity/index.min.js?ver=16.8.1" id="wp-interactivity-js" defer="" data-wp-strategy="defer"></script><script src="http://localhost/dev/wp-content/plugins/gutenberg/build/block-library/blocks/navigation/view.min.js?ver=e70a0a5a71dbbf7fc336" id="wp-block-navigation-view-js" defer="" data-wp-strategy="defer"></script>
    <script src="http://localhost/dev/wp-includes/js/dist/vendor/wp-polyfill-inert.min.js?ver=3.1.2" id="wp-polyfill-inert-js"></script>
    <script src="http://localhost/dev/wp-includes/js/dist/vendor/regenerator-runtime.min.js?ver=0.14.0" id="regenerator-runtime-js"></script>
    <script src="http://localhost/dev/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=3.15.0" id="wp-polyfill-js"></script>
    <script src="http://localhost/dev/wp-content/plugins/gutenberg/build/vendors/react.min.js?ver=18" id="react-js"></script>
    <script src="http://localhost/dev/wp-content/plugins/gutenberg/build/vendors/react-dom.min.js?ver=18" id="react-dom-js"></script>
    <script src="http://localhost/dev/wp-content/plugins/gutenberg/build/hooks/index.min.js?ver=700a21be8955e3eb9568" id="wp-hooks-js"></script>
    <script src="http://localhost/dev/wp-content/plugins/gutenberg/build/i18n/index.min.js?ver=f5a63315d8d2f363ce59" id="wp-i18n-js"></script>
    <script src="http://localhost/dev/wp-content/plugins/gutenberg/build/i18n/index.min.js?ver=f5a63315d8d2f363ce59" id="wp-i18n-js"></script>
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.