gulp-imagemin 8 will require to use ES module syntax.
We can modernize builder script following:
gulp-imagemin 8 will require to use ES module syntax.
We can modernize builder script following:
If the goal is to avoid any security issue, gulp-imagemin last version still has a DoS regexp issue with trim-newline dependency.
As Node 22 supports require for ESM too, at least experimentally, we can also require Node 22+ instead.
Some dependencies are loaded through ESM, like supports-color library directly for Node:
(node:25374) ExperimentalWarning: CommonJS module /opt/homebrew/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /opt/homebrew/lib/node_modules/npm/node_modules/supports-color/index.js using require(). Support for loading ES Module in require() is an experimental feature and might change at any time
In another hand, see also Gulp documentation: https://gulpjs.com/docs/en/getting-started/javascript-and-gulpfiles/
They recommend to install esm module to get import/export, instead of babel/@register.