I'd like to use a pure ESM npm package in my Gulp task. I cannot make my package an ESM package at this time. So I am trying to use dynamic import, as instructed by the author of the package.
.pipe(import('gulp-imagemin').then(module => {
return module([
module.svgo(
{plugins: iconSvgoPlugins}
)
])
}))
.pipe(dest(target))
The above produces the error:
TypeError: dest.on is not a function
at DestroyableTransform.Readable.pipe (/Users/bcn6069/Projects/oscar/lib/frontend/node_modules/readable-stream/lib/_stream_readable.js:564:8)
at /Users/bcn6069/Projects/oscar/lib/frontend/gulp/tasks/images.js:8:5
at Minify Images (/Users/bcn6069/Projects/oscar/lib/frontend/gulp/util.js:2:31)
at bound (domain.js:413:15)
at runBound (domain.js:424:12)
at asyncRunner (/Users/bcn6069/Projects/oscar/lib/frontend/node_modules/async-done/index.js:55:18)
at processTicksAndRejections (internal/process/task_queues.js:75:11)
Can anyone help tell me what I'm doing wrong?