I have a basic Next.js project with TypeScript that I have enhanced by adding Jimp. I am utilizing the experimental app
directory in my configuration.
This is how my next.config.js
file looks:
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
}
module.exports = nextConfig
In my page.tsx
, whenever I try to add Jimp using import Jimp from 'jimp';
and call its read
function
useEffect(() => {
// ...
(async () => {
const img = await Jimp.read(file);
})();
// ...
}, []);
I am encountering the following error:
Uncaught (in promise) TypeError: jimp__WEBPACK_IMPORTED_MODULE_1___default(...).read is not a function
, also console.log(Jimp.read)
returns undefined
.
What could I be overlooking here?