samrith-s / parcel-plugin-structurize

A plugin to customize the output (dist) directory structure during production.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[πŸ›] Bug: Plugin corrupts font files, PDFs

armselig opened this issue Β· comments

Describe the bug

When using parcel-plugin-structurize to move around font files and PDFs, the files end up corrupted. Files remain intact when project is built with PARCEL_PLUGIN_STRUCTURIZE=false.

Error messages

Chrome DevTools errors for font files:

18 Failed to decode downloaded font: <URL>
7 OTS parsing error: incorrect file size in WOFF header
OTS parsing error: Size of decompressed WOFF 2.0 is less than compressed size
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
OTS parsing error: incorrect entrySelector for table directory

Acrobat Pro DC error when opening PDF:

An error occurred while opening this document. This file is damaged and cannot be repaired.

Expected behavior

All files in the project should remain undamaged. :)

Information

  • macOS Catalina 10.15.7 (19H2)
  • node@15.11.0
  • npm@7.6.0
  • parcel-bundler@1.12.4
  • parcel-plugin-structurize@2.3.2
  • parcel-plugin-stylelint-all@0.2.0
  • parcel-plugin-typescript@1.0.0
"parcel-plugin-structurize": {
    "rules": [
      {
        "match": "*.{png,svg,jpg,jpg2,jpeg,gif,bmp,webm,webp}",
        "folder": "static/images"
      },
      {
        "match": "*.js",
        "folder": "static/scripts"
      },
      {
        "match": "*.css",
        "folder": "static/styles"
      },
      {
        "match": "*.{ttf,otf,woff,woff2}",
        "folder": "static/fonts"
      },
      {
        "match": "*.pdf",
        "folder": "static/download"
      }
    ]
  }

Hey @armselig

Thanks a lot for this. I'll have a look at this ASAP! :)

Hey @armselig,

You can check v2.3.3. It should fix the issue you are facing. :)

Feel free to reopen the issue if you still face the same problem.

Hi @samrith-s,

thank you very much for the prompt fix. The files are no longer getting corrupted. Great! <3

While testing everything, I ran into another problem. I'll open another issue if I have some time during/after work today.