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

imagemin-svgo version 10.0.0 compatibility

derBlume opened this issue · comments

imagemin-svgo introduced a breaking change with the latest version 10.0.0 which breaks compatibility with next-optimized-images. They switched from CommonJS Modules to ESM.

Related issue from the library: imagemin/imagemin-svgo#51

> Build error occurred
122Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: .../node_modules/imagemin-svgo/index.js
123require() of ES modules is not supported.
124require() of .../node_modules/imagemin-svgo/index.js from .../node_modules/next-optimized-images/lib/loaders/img-loader.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
125Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from .../node_modules/imagemin-svgo/package.json.