NodeJS 解决preact Brotli构建冲突:相同文件名

ulydmbyx  于 2022-12-22  发布在  Node.js
关注(0)|答案(1)|浏览(212)

当前行为

preact build --brotli打印以下错误:
‼ WARN Conflict: Multiple assets emit different content to the same filename .br

其他有关资料

  • 我的应用程序是标准的preact-cli“默认”(preact-cli模板)。
  • 未按预期使用--brotli标记构建。
  • 很明显,js文件被构建为.br,但没有文件名。
Environment Info:
    System:
      OS: Windows 10 10.0.19045
      CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Binaries:
      Node: 18.12.1
      npm: 8.4.1
    Browsers:
      Edge: Spartan (44.19041.1266.0), Chromium (108.0.1462.54)
    npmPackages:
      preact: ^10.11.2 => 10.11.2
      preact-cli: ^3.4.1 => 3.4.1
      preact-render-to-string: ^5.2.6 => 5.2.6
      preact-router: ^4.1.0 => 4.1.0

根据preact-cli文档和the only walkthrough I could find on expected behavior,我预计会看到...“所有生成的javascript文件旁边也有一个. js.br文件。”
重现该行为的步骤:

  1. preact build --brotli
    1.参见错误

错误

preact build --brotli

    ‼ WARN Could not find sw.js in C:\... Using the default service worker.

                           bundle.*****.esm.js ⏤  91.3 kB
                        polyfills.*****.esm.js ⏤  2.18 kB
              route-REDACT.chunk.6bef3.css ⏤  236 B
           route-REDACT.chunk.*****.esm.js ⏤  849 B
            route-REDACT.chunk.*****.esm.js ⏤  1.54 kB
        route-REDACT.chunk.64635.css ⏤  138 B
     route-REDACT.chunk.*****.esm.js ⏤  641 B
       route-REDACT.chunk.*****.esm.js ⏤  294 B
                                         sw.js ⏤  10.9 kB
                                     sw-esm.js ⏤  10.9 kB
                            polyfills.77b1f.js ⏤  2.28 kB
                                    index.html ⏤  1.66 kB (-19 B)
                                      200.html ⏤  1.17 kB
                              bundle.ccccc.css ⏤  5.36 kB
                 route-REDACT.chunk.230c8.css ⏤  139 B
              route-REDACT.chunk.*****.esm.js ⏤  405 B
               route-REDACT.chunk.f85cc.css ⏤  571 B
                               bundle.bbbbb.js ⏤  92.7 kB
                  route-REDACT.chunk.f4a3f.js ⏤  412 B
               route-REDACT.chunk.4a8c5.js ⏤  1.36 kB
                route-REDACT.chunk.56f91.js ⏤  2.14 kB
         route-REDACT.chunk.e7d3e.js ⏤  1.16 kB
           route-REDACT.chunk.68634.js ⏤  293 B

    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN asset size limit: The following asset(s) exceed the recommended size limit (195 KiB).
    This can impact web performance.
    Assets:
      bundle.aaaaa.esm.js (376 KiB)
      bundle.bbbbb.js (390 KiB)
    ‼ WARN entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (195 KiB). This can impact web performance.
    Entrypoints:
      bundle (785 KiB)
          bundle.ccccc.css
          bundle.bbbbb.js
          bundle.aaaaa.esm.js

    `your text`‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN Conflict: Multiple assets emit different content to the same filename .br
    ‼ WARN asset size limit: The following asset(s) exceed the recommended size limit (195 KiB).
    This can impact web performance.
    Assets:
      bundle.aaaaa.esm.js (376 KiB)
      bundle.bbbbb.js (390 KiB)
    ‼ WARN entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (195 KiB). This can impact web performance.
    Entrypoints:
      bundle (785 KiB)
          bundle.ccccc.css
          bundle.bbbbb.js
          bundle.aaaaa.esm.js
lnlaulya

lnlaulya1#

此问题的修复版本为preact-cli v3.4.3。

相关问题