Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
TypeError: dest.on is not a function when using dynamic imports in Gulp tasks

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!