question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERROR require() of ES Module imagemin-svgo not supported

See original GitHub issue

Hello, I’m running into this error when trying to use the library.

 ERROR  require() of ES Module /home/user/workspace/my-app/node_modules/imagemin-svgo/index.js from /home/user/workspace/my-app/node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js not supported.
Instead change the require of index.js in /home/user/workspace/my-app/node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js to a dynamic import() which is available in all CommonJS modules.

  Instead change the require of index.js in /home/user/workspace/my-app/node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js to a dynamic import() which is available in all CommonJS modules.
  at requireImageminPlugin (/home/user/workspace/my-app/node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js:20:10)
  at getImgLoaderOptions (/home/user/workspace/my-app/node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js:49:11)
  at applyImgLoader (/home/user/workspace/my-app/node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js:93:28)
  at appendLoaders (/home/user/workspace/my-app/node_modules/@aceforth/nuxt-optimized-images/lib/loaders/index.js:134:14)
  at WebpackBundler.<anonymous> (/home/user/workspace/my-app/node_modules/@aceforth/nuxt-optimized-images/lib/index.js:62:16)
  at next (/home/user/workspace/my-app/node_modules/@nuxt/utils/dist/utils.js:659:27)
  at WebpackBundler.<anonymous> (/home/user/workspace/my-app/node_modules/@nuxt/utils/dist/utils.js:674:12)
  at WebpackClientConfig.extendConfig (/home/user/workspace/my-app/node_modules/@nuxt/webpack/dist/webpack.js:1509:37)
  at WebpackClientConfig.config (/home/user/workspace/my-app/node_modules/@nuxt/webpack/dist/webpack.js:1544:50)
  at WebpackClientConfig.config (/home/user/workspace/my-app/node_modules/@nuxt/webpack/dist/webpack.js:1708:26)
  at WebpackBundler.getWebpackConfig (/home/user/workspace/my-app/node_modules/@nuxt/webpack/dist/webpack.js:2016:19)
  at WebpackBundler.build (/home/user/workspace/my-app/node_modules/@nuxt/webpack/dist/webpack.js:2023:12)
  at Builder.build (/home/user/workspace/my-app/node_modules/@nuxt/builder/dist/builder.js:327:30)
  at async Object._buildDev (/home/user/workspace/my-app/node_modules/@nuxt/cli/dist/cli-dev.js:107:5)
  at async Object.startDev (/home/user/workspace/my-app/node_modules/@nuxt/cli/dist/cli-dev.js:65:7)
  at async Object.run (/home/user/workspace/my-app/node_modules/@nuxt/cli/dist/cli-dev.js:52:5)
  at async NuxtCommand.run (/home/user/workspace/my-app/node_modules/@nuxt/cli/dist/cli-index.js:413:7)

I’m using Nuxt 2.15.7, together with Typescript.

What am I doing wrong?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Torgiancommented, Feb 2, 2022

I would like to make a PR to update this. My own project is dependent on this, and we are in the process of updating our dependencies.

0reactions
yordiscommented, Aug 10, 2022

@Torgian did you manage to do it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

require() of ES Module (.\node_modules\imagemin-svgo\index ...
Hi, I am getting wired error while trying to use next-optimised-images for nextjs12.x and node16.13.0 require() of ES Module (.
Read more >
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not ...
The current version of node-fetch is ONLY compatible with an ESM import (using import ), not from CommonJS modules using require() .
Read more >
imagemin-svgo - npm
SVGO imagemin plugin. Latest version: 10.0.1, last published: a year ago. Start using imagemin-svgo in your project by running `npm i ...
Read more >
gulp Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
The gulp error "[ERR_REQUIRE_ESM]: require() of ES Module not supported" occurs because the gulp-imagemin package has been converted to be an ESM only ......
Read more >
gulp-imagemin - Bountysource
Currently imagemin-svgo is limited to 7.x releases. ... stuck into this error when npm install: ... require() of ES modules is not supported....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found