preactjs / preact-cli

😺 Your next Preact PWA starts in 30 seconds.

Home Page:https://cli-demo-next.preactjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Brotli build - outputs content to same filename

jsgbc opened this issue · comments

commented

What is the current behaviour?
preact build --brotli prints the following error:
‼ WARN Conflict: Multiple assets emit different content to the same filename .br

Steps to Reproduce
Steps to reproduce the behavior:

  1. preact build --brotli
  2. See error

ERROR


‼ 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

‼ 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

What is the expected behaviour?
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."

Please mention any other relevant information

  • My app is a standard preact-cli 'Default' (preact-cli template).
  • Not using the --brotli flag builds as desired/expected.
  • It's clear the js files are being built to .br but with no filename.

Please paste the results of npx preact-cli info here.

  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 - C:\Program Files\nodejs\node.EXE
    npm: 8.4.1 - C:\Program Files\nodejs\npm.CMD
  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

It's a fairly long-standing bug, will try to take a look later at fixing.

FWIW, this is very niche and I've already removed this flag from the next version. If you do need to do AOT brotli compression I'd recommend looking into other solutions.

commented

It's a fairly long-standing bug, will try to take a look later at fixing.

FWIW, this is very niche and I've already removed this flag from the next version. If you do need to do AOT brotli compression I'd recommend looking into other solutions.

Thanks, can close.

Will keep this open as it's indeed an issue, just one that's existed for years with 0 complaints so I've not really been quick to fix.

Fix released as v3.4.3