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

v1.5.2 breaks next.js build #331

Closed
oxcened opened this issue Apr 21, 2023 · 6 comments
Closed

v1.5.2 breaks next.js build #331

oxcened opened this issue Apr 21, 2023 · 6 comments

Comments

@oxcened
Copy link

oxcened commented Apr 21, 2023

Hey just wanted to give a heads up that the latest patch (v1.5.2) suddently broke my Next.js app pipeline, I figure others may face the same.
Seems like an issue with encode-utf8.

 Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /usr/src/app/node_modules/encode-utf8/index.js
#10 74.85 require() of ES modules is not supported.
#10 74.85 require() of /usr/src/app/node_modules/encode-utf8/index.js from /usr/src/app/node_modules/qrcode/lib/core/byte-data.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.
#10 74.85 Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /usr/src/app/node_modules/encode-utf8/package.json.
#10 74.85 
#10 74.85     at new NodeError (internal/errors.js:322:7)
#10 74.85     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1131:13)
#10 74.85     at Module.load (internal/modules/cjs/loader.js:979:32)
#10 74.85     at Function.Module._load (internal/modules/cjs/loader.js:819:12)
#10 74.85     at Module.require (internal/modules/cjs/loader.js:1003:19)
#10 74.85     at require (internal/modules/cjs/helpers.js:107:18)
#10 74.85     at Object.<anonymous> (/usr/src/app/node_modules/qrcode/lib/core/byte-data.js:1:20)
#10 74.85     at Module._compile (internal/modules/cjs/loader.js:1114:14)
#10 74.85     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
#10 74.85     at Module.load (internal/modules/cjs/loader.js:979:32) {
#10 74.85   code: 'ERR_REQUIRE_ESM'
#10 74.85 }
#10 74.85

For now I'm fixing qrcode's version in my package to v1.5.1 as I'm not sure how this could be managed.

@qcasey
Copy link

qcasey commented Apr 21, 2023

Also broke one of my apps, same error

@yonigoldberg
Copy link

yonigoldberg commented Apr 21, 2023

Also broken for our SDK users

@soldair - this might be related to: dbbb46d

Any chance to revert and release v.1.5.3 to mitigate for now?

@NormandoHall
Copy link

Also broken sveltekit (vitejs)

@NormandoHall
Copy link

https://github.com/LinusU/encode-utf8/releases/tag/v2.0.0

💥 Breaking Changes
Convert package to ESM

Migration Guide:

This relases changes the package from a Common JS module to an EcmaScript module, and drops support for older versions of Node.

The minimum version of Node.js supported is now: 12.20.0, 14.13.1, and 16.0.0
The package must now be imported using the native import syntax instead of with require

@firrae
Copy link

firrae commented Apr 21, 2023

This is the problem LOC:

const encodeUtf8 = require('encode-utf8')

The solution is to properly handle ESM like someone tried to promote in #241, but that seems dead now. This has completely broken our application.

@soldair
Copy link
Owner

soldair commented Apr 22, 2023

resolved

@soldair soldair closed this as completed Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants