deptyped / prisma-extension-pagination

Prisma Client extension for pagination
https://npmjs.com/prisma-extension-pagination
MIT License
227 stars 17 forks source link

ESM error at build time "SyntaxError: Named export 'paginate' not found." #6

Closed SahidMiller closed 1 year ago

SahidMiller commented 1 year ago

Hi, I'm running into the following error after building this package

import { paginate } from "prisma-extension-pagination";

SyntaxError: Named export 'paginate' not found. The requested module 'prisma-extension-pagination' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

Fixing this error using default exports generates TS errors.

I believe this is caused by the package.json not having a type: "module" or not having microbundle emit with .mjs extension.

Removing "module": "/dist/index.mjs" and then running npm run build emits /dist/index.esm.mjs.

deptyped commented 1 year ago

@SahidMiller Can you test version 0.2.4? Should be fixed now

SahidMiller commented 1 year ago

Seems to be working great on my end. Thank you, @deptyped.

deptyped commented 1 year ago

@SahidMiller thank you for your contribution! I will close this issue. Feel free to open it if you discover any problems.