ProjectEvergreen/greenwood

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

オープン

#1,051 opened on 2023/02/05

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (15 件のフォーク)auto 404
CLIRouterbuggood first issue

Repository metrics

Stars
 (132 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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.

コントリビューターガイド