Facing issue in importing nextjs
avneet2112 opened this issue · comments
When I try to use compress.js latest version i.e. 1.2.1 then it shows a build error that regenerator runtime cannot import from outside the module. Please look into it.
same issue here. here's detail:
Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (2:0)
File was processed with these loaders:
* ./node_modules/next-translate/lib/cjs/plugin/loader.js
You may need an additional loader to handle the result of these loaders.
| // Support regenerator-runtime globally.
> import "regenerator-runtime/runtime.js";
|
| import Base64 from "./core/base64.js";
I get same build error in Next.js app.
I just got this as well in NextJS.
I ended up using https://www.npmjs.com/package/browser-image-compression instead. It's very similar to this, but it's already compiled in a compatible package type. It nearly a drop-in replacement.
I also got a solution here.
You can restrict the compress.js to the last update where it has 0 dependencies.
inside your package.json
replace this
"compress.js": "^1.1.2",
with this
"compress.js": "1.1.2",
Should be fixed in 1.2.2