Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support both ESM and CommonJS module #51

Closed
3c1u opened this issue Sep 14, 2021 · 11 comments
Closed

Support both ESM and CommonJS module #51

3c1u opened this issue Sep 14, 2021 · 11 comments

Comments

@3c1u
Copy link

3c1u commented Sep 14, 2021

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.

@creage
Copy link

creage commented Sep 14, 2021

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

@MrTomek
Copy link

MrTomek commented Sep 16, 2021

 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.

@derBlume
Copy link

derBlume commented Sep 22, 2021

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: cyrilwanner/next-optimized-images#264

@joemaller
Copy link

@Emiliano-Bucci
Copy link

News on this?

@patrikjuvonen
Copy link

Any updates?

cc @1000ch

@darshanputtaswamy
Copy link

Any Updates ?

@yaeru
Copy link

yaeru commented Dec 21, 2021

Any news?

@kouhin
Copy link

kouhin commented Feb 21, 2022

cc @1000ch 😁

@yordis
Copy link

yordis commented Aug 10, 2022

Hey there, any opportunity to get #57 reviewed and merged?

@sindresorhus
Copy link
Contributor

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2024
@imagemin imagemin locked as resolved and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests