DeMoorJasper / parcel-plugin-imagemin

Parcel image minification plugin
MIT License
129 stars 7 forks source link

Issues with non-asset images #18

Closed bre7 closed 6 years ago

bre7 commented 6 years ago

Hi Jasper, while creating an issue in Parcel's repo I bumped into an issue with the plugin. Using a simple index.html with 2 images: while the other is an href (am I the only one displaying fullscreen images and using Parcel ? 😢).

Is this because the plugin assumes that images will be hashed ? But since one is an entrypoint, it will be copied as-is.

Error message:

Server running at http://localhost:1234 × ENOENT: no such file or directory, open 'C:\path\parcel-plugin-imagemin-18\dist\images\gallery\foo.jpeg' Error: ENOENT: no such file or directory, open 'C:\path\parcel-plugin-imagemin-18\dist\images\gallery\foo.jpeg'

Repro: https://github.com/bre7/parcel-plugin-imagemin-18

DeMoorJasper commented 6 years ago

Ow it's probably because my custom packager doesn't check if the directory exists. Should be an easy fix, it assumed the original flat structure parcel originally used.

bre7 commented 6 years ago

Not sure why but mkdirp isn't working as expected. Managed to fix it with fs-extra, PR asap.