ProjectEvergreen/greenwood

static router outputting a `<script>` tag with a path of `/undefined` (when an SSR route is present?)

Offen

#1.051 geöffnet am 05.02.2023

 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (15 Forks)auto 404
CLIRouterbuggood first issue

Repository-Metriken

Stars
 (132 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 25T 20h) (29 gemergte PRs in 30 T)

Beschreibung

Type of Change

Bug

Summary

Noticed that although the specs are passing, the generated output from the test produces a <script> and <link> preload tag with src and href respectively with a value of /undefined.

<!DOCTYPE html>
  <html lang="en" prefix="og:http://ogp.me/ns#">


  <head>
    <link rel="modulepreload" href="/undefined" as="script">
    ...
    
    <script type="module" src="/undefined"></script>

    <script>window.__greenwood = window.__greenwood || {}; window.__greenwood.currentTemplate = "page";</script>
  </head>

  <body>
    ...
  </body>

</html>

Details

I notice in the test case build.config.static-router.spec.js that it also contains an SSR route, so that is what could be accounting for this errant <script> tag?

Would be good to make sure fix this and adjust the specs accordingly. My guess is to start in the bundle lifecycle and see what resource are being tracked.

Contributor Guide