framework icon indicating copy to clipboard operation
framework copied to clipboard

allow modifying public assets after build (or in hook)

Open kstraszewski opened this issue 2 years ago • 5 comments

Environment

Reproduction

I have purgecss running from CLI after building and app. Like on the top of the build process, after updating it to rc9 purgecss (which clears vuetify styles) generate ERR_CONTENT_LENGTH_MISMATCH error. But I couldn't manage to reproduce it on stackblitz.

  1. build the app
  2. use purgecss CLI purgecss -c purgeCSSConfig.js
  3. serve the app

Describe the bug

Purging css after build by using purgecss breaks fetching CSS. purgecss -c purgeCSSConfig.js

Additional context

No response

Logs

No response

kstraszewski avatar Sep 04 '22 12:09 kstraszewski

@danielroe Here is a reproduction: https://stackblitz.com/edit/github-w6cj1g-eqr6s9?file=package.json

But on stackblitz everything works, you need to download project locally, then:

  1. npm I
  2. npm run build
  3. npm purge
  4. npm preview

Im getting ERR_CONTENT_LENGTH_MISMATCH error on every CSS file that was purged, it may be a Mac m1 problem. But on rc6 everything was 100% ok (I think on rc8 also). It might be something with new nitro 0.5.0

kstraszewski avatar Sep 06 '22 13:09 kstraszewski

When i try to use purgecss "proper way" by using postcss.plygins['@fullhuman/postcss-purgecss'] in nuxt.config.js. Im getting this error: https://github.com/unocss/unocss/issues/1538

kstraszewski avatar Sep 06 '22 15:09 kstraszewski

I'm getting the same issue on some png files. svg are fine. Perhaps some kind of optimizer is running?

markgibbons25 avatar Sep 09 '22 00:09 markgibbons25

Ahh. The issue is that etags/size/mime/encoding is calculated when the nitro build happens, and you are modifying the files afterwards.

danielroe avatar Sep 09 '22 08:09 danielroe

Having the same issue. In nuxt 2 my CMS could add pictures to /static and its still being served. Now it says file not found.

rnenjoy avatar Sep 16 '22 11:09 rnenjoy