Closed 3c1u closed 4 months ago
It also breaks image-minimizer-webpack-plugin
:
WARNING in Unknown plugin: imagemin-svgo
Did you forget to install the plugin?
You can install it with:
$ npm install imagemin-svgo --save-dev
$ yarn add imagemin-svgo --dev
ERROR Must use import to load ES Module: .../node_modules/imagemin-svgo/index.js nuxt:@aceforth/nuxt-optimized-images 15:25:54
require() of ES modules is not supported.
require() of .../node_modules/imagemin-svgo/index.js from .../node_modules/@aceforth/nuxt-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.
Instead 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.
It also breaks next-optimized-images
:
> 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.
Releated issue: https://github.com/cyrilwanner/next-optimized-images/issues/264
News on this?
Any updates?
cc @1000ch
Any Updates ?
Any news?
cc @1000ch 😁
Hey there, any opportunity to get #57 reviewed and merged?
The recent update (v10.0.0) breaks
nuxt-optimized-images
because of lacking support of CommonJS. Including both ESM and CommonJS files would be ideal.