ProjectEvergreen/greenwood

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

开放

#1,051 创建于 2023年2月5日

 (1 条评论) (0 个反应) (0 位负责人)JavaScript (15 个派生)auto 404
CLIRouterbuggood first issue

仓库指标

星标
 (132 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南