Comments (9)
Fixed and published please upgrade to [email protected]
from imagetools.
This is really bad π
This only appears during development right? So when you do yarn build all the right images get generated?
from imagetools.
Oh, I haven't even thought about testing that. And yeah, you're right, it works in production, so it isn't that terrible after all.
from imagetools.
This only appears during development right? So when you do yarn build all the right images get generated?
oh god dammit... I've been cracking my head trying to figure this one out...
yeah.... can confirm, at least on my testing, the switch happens alright once deployed, just during dev that it only shows the last size
from imagetools.
@JonasKruckenberg I just hit this one too. The problem seems to be in the vite plugin and the middleware added in configureServer
. To debug I looked for use of generatedImages
and added the following:
// before generatedImage.set
console.log("set image", id, imagetoolsCore.getMetadata(image, 'width'))
// after generatedImage.get (in middleware)
console.log("get image", id, imagetoolsCore.getMetadata(image, 'width'))
In the logs...
set image 6269821afe096f8aea2f2ba455cddea6fa0b734a 500
set image cb68b63cfb6eadc77da1ba1b4f5866595fe545e2 700
get image 6269821afe096f8aea2f2ba455cddea6fa0b734a 700 <--- ooops!
get image cb68b63cfb6eadc77da1ba1b4f5866595fe545e2 700
Something is being reused somewhere...? I then modified this line:
// generatedImages.set(id, image); // from
generatedImages.set(id, image.clone()); // to
New log output:
set image 6269821afe096f8aea2f2ba455cddea6fa0b734a 500
set image cb68b63cfb6eadc77da1ba1b4f5866595fe545e2 700
get image 6269821afe096f8aea2f2ba455cddea6fa0b734a undefined
get image cb68b63cfb6eadc77da1ba1b4f5866595fe545e2 undefined
... and images in the site are the correct size π.
from imagetools.
I guess it is because of this line:
const img = imagetoolsCore.loadImage(decodeURIComponent(srcURL.pathname));
... this img
is passed to imagetoolsCore.applyTransforms
and returned, so same image is put in the Set
.
from imagetools.
Good catch! The sharp instance is mutable indeed and so will be changed by subsequent iterations, cloning should solve this!
from imagetools.
Hey, this issue seems to have been fixed by the PR #218 , but was rolled back by this commit f6cec96 .
Is there a reason for that?
from imagetools.
Oups, must have been lost in the merges somehow!
from imagetools.
Related Issues (20)
- Query strings don't work in dynamic imports with template literals containing variables HOT 8
- Upgrading to Vite 4.4.0 broke vite-imagetools HOT 5
- imagetools-core 4.0.4 `resolveConfigs` behavior change, `format` directive no longer working
- Build and build -w output differs HOT 6
- as=source and as=srcset both outputting srcset with all the same width params HOT 3
- manifest.json is generated incorrectly HOT 2
- Upgrading Vite-imagetools 5.0.8 throws an error from 4.x version HOT 2
- generateImageID causes tests to fail on CI HOT 3
- Vite example has a typo HOT 1
- Renaming picture fallback to img is not reflected in the document HOT 1
- Waste less effort transforming images
- Dependency on sharp not declared correctly for yarnβs PnP loader HOT 9
- Vite plugin crash HOT 2
- Loading attribute HOT 1
- v6 broken due to missing sharp 0.33 binariers HOT 3
- Some images get rotated for some reason HOT 14
- crop from / "gravity" HOT 1
- Error: Unable to parse color from string: ##ffaa22
- Pre-transform error: Failed to parse source for import analysis because the content contains invalid JS syntax
- How to receive access to original image in `extendOutputFormats` after v7.0.0? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imagetools.