Open mklueh opened 2 years ago
I'm also getting a similar issue with nuxt v2.15.8 and node v16.13.0 which is the following:
ERROR require() of ES Module /(...)/node_modules/imagemin-mozjpeg/index.js from /(...)/node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js not supported.
Instead change the require of index.js in /(...)/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 node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js to a dynamic import() which is available in all CommonJS modules.
at requireImageminPlugin (node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js:20:10)
at getImgLoaderOptions (node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js:41:11)
at applyImgLoader (node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js:93:28)
at appendLoaders (node_modules/@aceforth/nuxt-optimized-images/lib/loaders/index.js:134:14)
at WebpackBundler.<anonymous> (node_modules/@aceforth/nuxt-optimized-images/lib/index.js:62:16)
at next (node_modules/@nuxt/utils/dist/utils.js:659:27)
at WebpackBundler.<anonymous> (node_modules/@nuxt/utils/dist/utils.js:674:12)
at WebpackClientConfig.extendConfig (node_modules/@nuxt/webpack/dist/webpack.js:1509:37)
at WebpackClientConfig.config (node_modules/@nuxt/webpack/dist/webpack.js:1544:50)
at WebpackClientConfig.config (node_modules/@nuxt/webpack/dist/webpack.js:1708:26)
at WebpackBundler.getWebpackConfig (node_modules/@nuxt/webpack/dist/webpack.js:2016:19)
at WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:2023:12)
at Builder.build (node_modules/@nuxt/builder/dist/builder.js:327:30)
at async Object._buildDev (node_modules/@nuxt/cli/dist/cli-dev.js:107:5)
at async Object.startDev (node_modules/@nuxt/cli/dist/cli-dev.js:65:7)
at async Object.run (node_modules/@nuxt/cli/dist/cli-dev.js:52:5)
at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:413:7)
It's most likely something to do with the newer node versions but just posting here anyways.
I have the same issue.
Using node v16.13.1, npm 8.1.2
ERROR require() of ES Module xxx/node_modules/imagemin-mozjpeg/index.js from xxx/node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js not supported.
Instead change the require of index.js in xxx/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 node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js to a dynamic import() which is available in all CommonJS modules.
at requireImageminPlugin (node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js:20:10)
at getImgLoaderOptions (node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js:41:11)
at applyImgLoader (node_modules/@aceforth/nuxt-optimized-images/lib/loaders/img-loader.js:93:28)
at appendLoaders (node_modules/@aceforth/nuxt-optimized-images/lib/loaders/index.js:134:14)
at WebpackBundler.<anonymous> (node_modules/@aceforth/nuxt-optimized-images/lib/index.js:62:16)
at next (node_modules/@nuxt/utils/dist/utils.js:659:27)
at WebpackBundler.<anonymous> (node_modules/@nuxt/utils/dist/utils.js:674:12)
at WebpackBundler.<anonymous> (node_modules/@nuxt/utils/dist/utils.js:668:29)
at WebpackBundler.<anonymous> (node_modules/@nuxt/utils/dist/utils.js:668:29)
at WebpackBundler.<anonymous> (node_modules/@nuxt/utils/dist/utils.js:668:29)
at WebpackClientConfig.extendConfig (node_modules/@nuxt/webpack/dist/webpack.js:1509:37)
at WebpackClientConfig.config (node_modules/@nuxt/webpack/dist/webpack.js:1544:50)
at WebpackClientConfig.config (node_modules/@nuxt/webpack/dist/webpack.js:1708:26)
at WebpackBundler.getWebpackConfig (node_modules/@nuxt/webpack/dist/webpack.js:2016:19)
at WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:2023:12)
at Builder.build (node_modules/@nuxt/builder/dist/builder.js:327:30)
at async Object.run (node_modules/@nuxt/cli/dist/cli-build.js:110:7)
at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:413:7)
Had the same issue after updating both imagemin-svgo and imagemin-mozjpeg to version 10. When I went back to version 9 this error disappeared. Not a fix obviously but at least the code works again.
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.
@Torgian did you manage to do it?
Hello, I'm running into this error when trying to use the library.
I'm using Nuxt 2.15.7, together with Typescript.
What am I doing wrong?