cyrilwanner / next-optimized-images

🌅 next-optimized-images automatically optimizes images used in next.js projects (jpeg, png, svg, webp and gif).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for imagemin-mozjpeg v10

simPod opened this issue · comments

Same as #264 but for mozjpeg.

I think the change is this one imagemin/imagemin-mozjpeg@9f3f702

Error [ERR_REQUIRE_ESM]: require() of ES Module /path/node_modules/imagemin-mozjpeg/index.js from /path/node_modules/next-optimized-images/lib/loaders/img-loader.js not supported.
Instead change the require of index.js in /path/node_modules/next-optimized-images/lib/loaders/img-loader.js to a dynamic import() which is available in all CommonJS modules.
at requireImageminPlugin (/path/node_modules/next-optimized-images/lib/loaders/img-loader.js:21:10)
at getImgLoaderOptions (/path/node_modules/next-optimized-images/lib/loaders/img-loader.js:42:11)
at applyImgLoader (/path/node_modules/next-optimized-images/lib/loaders/img-loader.js:96:28)
at appendLoaders (/path/next-optimized-images/lib/loaders/index.js:137:14)
at Object.webpack (/path/next-optimized-images/lib/index.js:62:24)
at Object.newWebpackFunction [as webpack] (/path/@sentry/nextjs/dist/config/webpack.js:39:40)
at Object.getBaseWebpackConfig [as default] (/path/next/dist/build/webpack-config.js:1176:32)
at async Promise.all (index 0)
at async Span.traceAsyncFn (/path/next/dist/trace/trace.js:79:20)
at async /path/next/dist/build/index.js:322:29
at async /path/next/dist/build/index.js:318:9
at async Span.traceAsyncFn (/path/next/dist/trace/trace.js:79:20)
at async Object.build [as default] (/path/next/dist/build/index.js:55:25) {
code: 'ERR_REQUIRE_ESM'
commented

@simPod
Temporary solution written in #270
Downgrade mozjpeg to 9.0.0

@zWarMob that is not a solution