wobsoriano / fastify-next-auth

Auth.js plugin for Fastify.
MIT License
49 stars 3 forks source link

Error while importing in Common js #10

Open dev-rish opened 6 months ago

dev-rish commented 6 months ago

I have a project that already uses common js. I am trying to implement auth via credentials. When I import like so

const AuthPlugin = require("fastify-next-auth");
const CredentialsProvider = require("@auth/core/providers/credentials");

I get the following error

node:internal/modules/cjs/loader:488
      throw e;
      ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in D:\Projects\mapsted-admin\node_modules\@auth\core\package.json

Lib Versions

"@auth/core": "^0.26.2"
"fastify": "^4.24.3"
"fastify-next-auth": "^0.7.0"

Any way to fix it without updating the package.json to have "type": "module"?