ProjectEvergreen/greenwood

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

Ouverte

#1 051 ouverte le 5 févr. 2023

 (1 commentaire) (0 réaction) (0 personne assignée)JavaScript (15 forks)auto 404
CLIRouterbuggood first issue

Métriques du dépôt

Stars
 (132 étoiles)
Métriques de merge PR
 (Merge moyen 25j 20h) (29 PRs mergées en 30 j)

Description

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.

Guide contributeur