Title: ReferenceError: Main is not defined
Last modified: March 12, 2020

---

# ReferenceError: Main is not defined

 *  [tomn68](https://wordpress.org/support/users/tomn68/)
 * (@tomn68)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/)
 * Once I set “Enable Async JavaScript?”, I’m seeing this in the console…
 * ReferenceError: Main is not definedaventriahealth.com:639:1
    <anonymous> [https://aventriahealth.com/:639](https://aventriahealth.com/:639)
 * But I’m not sure which script (which are autopitized) this might be coming from.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Freferenceerror-main-is-not-defined%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12537274)
 * wordfence is blocking me when trying to disable asyncjs/ autoptimize with querystring
   parameters tomn68, can’t troubleshoot like that I’m afraid :-/
 * ![](https://i0.wp.com/i.imgur.com/SiIlD7F.jpg?ssl=1)
 *  Thread Starter [tomn68](https://wordpress.org/support/users/tomn68/)
 * (@tomn68)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12537335)
 * Ugh. Yeah I suspect we’re blocking countries and I can’t change that. Bummer.
   Anything I can try on my end?
 * Tom
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12537364)
 * well, what I do is run the page with ?ao_noptimize=1 (disabling Autoptimize) 
   and ?aj_noptimize=1 (disabling AsyncJS) and compare results to see in which case(
   s) things work as a first step.
 *  Thread Starter [tomn68](https://wordpress.org/support/users/tomn68/)
 * (@tomn68)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12537400)
 * **ao_notimize**
    ?ao_noptimize=1:894 Uncaught ReferenceError: Main is not defined
   at ?ao_noptimize=1:894 (anonymous) @ ?ao_noptimize=1:894 jquery-migrate.min.js?
   ver=1.4.1:2 JQMIGRATE: Migrate is installed, version 1.4.1 ?ao_noptimize=1:209
   Uncaught TypeError: jQuery(…).slicknav is not a function at HTMLDocument.<anonymous
   > (?ao_noptimize=1:209) at i (jquery.js?ver=1.12.4-wp:2) at Object.fireWith [
   as resolveWith] (jquery.js?ver=1.12.4-wp:2) at Function.ready (jquery.js?ver=
   1.12.4-wp:2) at HTMLDocument.J (jquery.js?ver=1.12.4-wp:2) (anonymous) @ ?ao_noptimize
   =1:209 i @ jquery.js?ver=1.12.4-wp:2 fireWith @ jquery.js?ver=1.12.4-wp:2 ready
   @ jquery.js?ver=1.12.4-wp:2 J @ jquery.js?ver=1.12.4-wp:2 ?ao_noptimize=1:1 A
   cookie associated with a cross-site resource at [https://app-sj11.marketo.com/](https://app-sj11.marketo.com/)
   was set without the `SameSite` attribute. It has been blocked, as Chrome now 
   only delivers cookies with cross-site requests if they are set with `SameSite
   =None` and `Secure`. You can review cookies in developer tools under Application
   >Storage>Cookies and see more detail
 * **with aj_noptize=1 I only get…**
    JQMIGRATE: Migrate is installed, version 1.4.1?
   aj_noptimize=1:1 A cookie associated with a cross-site resource at [https://app-sj11.marketo.com/](https://app-sj11.marketo.com/)
   was set without the `SameSite` attribute. It has been blocked, as Chrome now 
   only delivers cookies with cross-site requests if they are set with `SameSite
   =None` and `Secure`. You can review cookies in developer tools under Application
   >Storage>Cookies and see more details at [https://www.chromestatus.com/feature/5088147346030592](https://www.chromestatus.com/feature/5088147346030592)
   and [https://www.chromestatus.com/feature/5633521622188032](https://www.chromestatus.com/feature/5633521622188032).
 *  Thread Starter [tomn68](https://wordpress.org/support/users/tomn68/)
 * (@tomn68)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12537422)
 * THen in sources when using ?ao_noptimize=1 I see the exception on Main.boot below
 * </script><script type=’text/javascript’ async=’async’ src=’[https://aventriahealth.com/wp-content/plugins/responsive-navigation/assets/js/jquery.slicknav.js?ver=1.0′></script&gt](https://aventriahealth.com/wp-content/plugins/responsive-navigation/assets/js/jquery.slicknav.js?ver=1.0′></script&gt);
   
   <script type=’text/javascript’ defer=’defer’ src=’[https://aventriahealth.com/wp-includes/js/jquery/ui/core.min.js?ver=1.11.4′></script&gt](https://aventriahealth.com/wp-includes/js/jquery/ui/core.min.js?ver=1.11.4′></script&gt);
   <script type=’text/javascript’ defer=’defer’ src=’[https://aventriahealth.com/wp-includes/js/jquery/ui/widget.min.js?ver=1.11.4′></script&gt](https://aventriahealth.com/wp-includes/js/jquery/ui/widget.min.js?ver=1.11.4′></script&gt);
   <script type=’text/javascript’ defer=’defer’ src=’[https://aventriahealth.com/wp-includes/js/jquery/ui/mouse.min.js?ver=1.11.4′></script&gt](https://aventriahealth.com/wp-includes/js/jquery/ui/mouse.min.js?ver=1.11.4′></script&gt);
   <script type=’text/javascript’ defer=’defer’ src=’[https://aventriahealth.com/wp-includes/js/jquery/ui/sortable.min.js?ver=1.11.4′></script&gt](https://aventriahealth.com/wp-includes/js/jquery/ui/sortable.min.js?ver=1.11.4′></script&gt);
   <script type=’text/javascript’ async=’async’ src=’[https://aventriahealth.com/wp-content/plugins/responsive-accordion-and-collapse/js/bootstrap.js?ver=54466f2d8726088b385ce732b570e25a’></script&gt](https://aventriahealth.com/wp-content/plugins/responsive-accordion-and-collapse/js/bootstrap.js?ver=54466f2d8726088b385ce732b570e25a’></script&gt);
   <script type=’text/javascript’ async=’async’ src=’[https://aventriahealth.com/wp-content/plugins/responsive-accordion-and-collapse/js/accordion.js?ver=54466f2d8726088b385ce732b570e25a’></script&gt](https://aventriahealth.com/wp-content/plugins/responsive-accordion-and-collapse/js/accordion.js?ver=54466f2d8726088b385ce732b570e25a’></script&gt);
   <script type=’text/javascript’ async=’async’ src=’[https://aventriahealth.com/wp-content/plugins/simple-share-buttons-adder/js/ssba.js?ver=54466f2d8726088b385ce732b570e25a’></script&gt](https://aventriahealth.com/wp-content/plugins/simple-share-buttons-adder/js/ssba.js?ver=54466f2d8726088b385ce732b570e25a’></script&gt);
   <script type=’text/javascript’> Main.boot( [] ); </script> <script type=’text/
   javascript’ defer=’defer’ src=’[https://aventriahealth.com/wp-includes/js/imagesloaded.min.js?ver=3.2.0′></script&gt](https://aventriahealth.com/wp-includes/js/imagesloaded.min.js?ver=3.2.0′></script&gt);
   <script type=’text/javascript’ defer=’defer’ src=’[https://aventriahealth.com/wp-includes/js/masonry.min.js?ver=3.3.2′></script&gt](https://aventriahealth.com/wp-includes/js/masonry.min.js?ver=3.3.2′></script&gt);
   <script type=’text/javascript’ defer=’defer’ src=’[https://aventriahealth.com/wp-includes/js/jquery/jquery.masonry.min.js?ver=3.1.2b’></script&gt](https://aventriahealth.com/wp-includes/js/jquery/jquery.masonry.min.js?ver=3.1.2b’></script&gt);
   <script type=’text/javascript’ defer=’defer’ src=’[https://aventriahealth.com/wp-content/plugins/templatesnext-toolkit/js/owl.carousel.min.js?ver=1.3.2′></script&gt](https://aventriahealth.com/wp-content/plugins/templatesnext-toolkit/js/owl.carousel.min.js?ver=1.3.2′></script&gt);
   <script type=’text/javascript’ defer=’defer’ src=’[https://aventriahealth.com/wp-content/plugins/templatesnext-toolkit/js/jquery.colorbox-min.js?ver=1.5.14′></script&gt](https://aventriahealth.com/wp-content/plugins/templatesnext-toolkit/js/jquery.colorbox-min.js?ver=1.5.14′></script&gt);
   <script type=’text/javascript’ defer=’defer’ src=’[https://aventriahealth.com/wp-content/plugins/templatesnext-toolkit/js/jquery.inview.min.js?ver=1.0.0′></script&gt](https://aventriahealth.com/wp-content/plugins/templatesnext-toolkit/js/jquery.inview.min.js?ver=1.0.0′></script&gt);
   <script type=’text/javascript’ async=’async’ src=’[https://aventriahealth.com/wp-content/plugins/templatesnext-toolkit/js/tx-script.js?ver=2013-07-18′></script&gt](https://aventriahealth.com/wp-content/plugins/templatesnext-toolkit/js/tx-script.js?ver=2013-07-18′></script&gt);
   <script type=’text/javascript’> /* <![CDATA[ */ var themeMyLogin = {“action”:””,”
   errors”:[]}; /* ]]> */
 *  Thread Starter [tomn68](https://wordpress.org/support/users/tomn68/)
 * (@tomn68)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12544123)
 * Was any of this helpful?
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12544268)
 * sorry, hadn’t seen previous comments.
 * can you try excluding `plugins/simple-share-buttons-adder/` from async JS?
 *  Thread Starter [tomn68](https://wordpress.org/support/users/tomn68/)
 * (@tomn68)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12544824)
 * Yup. That did it.
 * The only one I have left is…
 * (index):196 Uncaught TypeError: jQuery(…).slicknav is not a function
    at HTMLDocument.
   <anonymous> ((index):196) at i (jquery.js?ver=1.12.4-wp:2) at Object.fireWith[
   as resolveWith] (jquery.js?ver=1.12.4-wp:2) at Function.ready (jquery.js?ver=
   1.12.4-wp:2) at HTMLDocument.J (jquery.js?ver=1.12.4-wp:2)
 * I couldn’t find a slicknav plugin though. Maybe part of the them. Will try to
   track it down(disabled the Async for now) unless you have some ideas. Thanks 
   again for the help.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12544963)
 * disable JS optimization in Autopitmize for a second to see the original filenames,
   you’ll probably see slicknav that way.
 *  Thread Starter [tomn68](https://wordpress.org/support/users/tomn68/)
 * (@tomn68)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12546443)
 * Thanks. So I did find it. Best to just exclude the Responsive Navigation plugin
   or just the script?
 * I excluded the plugin and I think works.
 * Tom
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12546450)
 * if it works, just leave as is 🙂

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘ReferenceError: Main is not defined’ is closed to new replies.

 * ![](https://ps.w.org/async-javascript/assets/icon-128x128.png?rev=1839260)
 * [Async JavaScript](https://wordpress.org/plugins/async-javascript/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/async-javascript/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/async-javascript/)
 * [Active Topics](https://wordpress.org/support/plugin/async-javascript/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/async-javascript/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/async-javascript/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/referenceerror-main-is-not-defined/#post-12546450)
 * Status: not resolved