node.jswebpackpreactbrotlipreact-cli

Resolve preact Brotli build conflict: same filename


current behavior

preact build --brotli prints the following error:

‼ WARN Conflict: Multiple assets emit different content to the same filename .br

other relevant information

    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

Per the preact-cli documentation combined with the only walkthrough I could find on expected behavior I expected to see "... all the generated javascript files also have a .js.br files next to them."

Steps to reproduce the behavior:

  1. preact build --brotli
  2. See error

error

    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

Solution

  • Fix for this issue was release as preact-cli v3.4.3.