ulyanov-programmer / gulp-sharp-optimize-images Goto Github PK
View Code? Open in Web Editor NEWCompression and conversion of images for gulp using sharp.
Compression and conversion of images for gulp using sharp.
hi
i wanted to try your lib but i get
Requiring external module @babel/register
Error [ERR_REQUIRE_ESM]: require() of ES Module D:\laragon\www\florarie\node_modules\gulp-sharp-optimize-images\index.js from D:\laragon\www\florarie\task-runners\images.js not supported.
Instead change the require of index.js in D:\laragon\www\florarie\task-runners\images.js to a dynamic import() which is available in all CommonJS modules.
at Object.newLoader [as .js] (D:\laragon\www\florarie\node_modules\pirates\lib\index.js:141:7)
at Object.<anonymous> (D:\laragon\www\florarie\task-runners\images.js:11:27)
at Module._compile (D:\laragon\www\florarie\node_modules\pirates\lib\index.js:136:24)
at Object.newLoader [as .js] (D:\laragon\www\florarie\node_modules\pirates\lib\index.js:141:7)
at requireDir (D:\laragon\www\florarie\node_modules\require-dir\index.js:128:33)
at Object.<anonymous> (D:\laragon\www\florarie\gulpfile.babel.js:40:1)
at Module._compile (D:\laragon\www\florarie\node_modules\pirates\lib\index.js:136:24)
at Object.newLoader [as .js] (D:\laragon\www\florarie\node_modules\pirates\lib\index.js:141:7)
at async Promise.all (index 0) {
code: 'ERR_REQUIRE_ESM'
any idea what i can do to solve this ?
Hello.
When I automatically built and deploy my project on GitHub Pages using GitHub Actions (github-pages-deploy-action), I discovered that this library was generating incorrect file paths for images. The generated paths contained an escaped backslash as a separator between the filename and base path, which seems to be handled incorrectly on Linux. This results in filenames being generated with the base path included (see screenshot).
I suspect the culprit might be line 103, where the full file path is being created. Perhaps the fix could be as simple as replacing the escaped backslash with a single slash (/). Though I don't know for sure :)
let newFilePath = `${file.dirname}/${newFileName}`
After upgrading to [email protected]
I get the following traceback while using gulp-sharp-optimize-images
:
[11:12:29] Error: Input buffer contains unsupported image format
at Sharp.toBuffer (D:\Workspace\egu\node_modules\sharp\lib\output.js:161:17)
at convert (file:///D:/Workspace/egu/node_modules/gulp-sharp-optimize-images/index.js:86:38)
at Transform._transform (file:///D:/Workspace/egu/node_modules/gulp-sharp-optimize-images/index.js:68:25)
at Transform._read (D:\Workspace\egu\node_modules\gulp-sharp-optimize-images\node_modules\readable-stream\lib\_stream_transform.js:166:10)
at Transform._write (D:\Workspace\egu\node_modules\gulp-sharp-optimize-images\node_modules\readable-stream\lib\_stream_transform.js:155:83)
at doWrite (D:\Workspace\egu\node_modules\gulp-sharp-optimize-images\node_modules\readable-stream\lib\_stream_writable.js:390:139)
at writeOrBuffer (D:\Workspace\egu\node_modules\gulp-sharp-optimize-images\node_modules\readable-stream\lib\_stream_writable.js:381:5)
at Transform.Writable.write (D:\Workspace\egu\node_modules\gulp-sharp-optimize-images\node_modules\readable-stream\lib\_stream_writable.js:302:11)
at Transform.ondata (node:internal/streams/readable:1007:22)
at Transform.emit (node:events:518:28)
at Transform.emit (node:domain:551:15)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushObjectMode (node:internal/streams/readable:536:3)
at Transform.Readable.push (node:internal/streams/readable:391:5)
at node:internal/streams/transform:178:12
at file:///D:/Workspace/egu/node_modules/easy-transform-stream/index.js:18:7
at processTicksAndRejections (node:internal/process/task_queues:95:5)
After downgrading to [email protected]
it works again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.