GoogleChromeLabs / prerender-loader

📰 Painless universal pre-rendering for Webpack.
https://npm.im/prerender-loader
Apache License 2.0
1.91k stars 50 forks source link

ReferenceError when external resources loaded #38

Open Bastorx opened 5 years ago

Bastorx commented 5 years ago

Error :

Module build failed (from ./node_modules/prerender-loader/dist/prerender-loader.js):
NonErrorEmittedError: (Emitted value instead of an instance of Error) ReferenceError: $ is not defined

In Index.html

<body>
    <div id="app"></div>
    <!-- jQuery -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <!-- jQuery Easing -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
    <!-- Bootstrap -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <!-- Waypoints -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.0/jquery.waypoints.min.js"></script>
    <!-- Stellar Parallax -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/stellar.js/0.6.2/jquery.stellar.min.js"></script>
    <!-- Easy PieChart -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/easy-pie-chart/2.1.6/jquery.easypiechart.js"></script>

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-146273121-1"> </script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', 'UA-146273121-1');
    </script>
</body>

In my Component :

  public componentDidMount() {
    if (!isMobile.any()) {
      $(".js-fullheight").css("height", $(window).height());
      $(window).resize(() => {
        $(".js-fullheight").css("height", $(window).height());
      });
    }
  }

The problem is, I'm loading jquery from a Githubissues.

  • Githubissues is a development platform for aggregating issues.