next-auth
Add default exports to package.json for better module support
#11224
Merged

Add default exports to package.json for better module support #11224

roonie007
roonie007332 days ago

☕️ Reasoning

When using Auth + Express in a ModernJS project, I ran throught this error

Error: No "exports" main defined in __PROJECT_PATH__/node_modules/@auth/core/package.json
  at exportsNotFound (node:internal/modules/esm/resolve:299:10)
  at packageExportsResolve (node:internal/modules/esm/resolve:589:13)
  at resolveExports (node:internal/modules/cjs/loader:621:36)
  at Function.Module._findPath (node:internal/modules/cjs/loader:711:31)
  at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1198:27)
  at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue (__PROJECT_PATH__/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
  at Function.Module._resolveFilename (__PROJECT_PATH__/node_modules/esbuild-register/dist/node.js:4799:36)
  at Function.d._resolveFilename (__PROJECT_PATH__/node_modules/@modern-js/utils/dist/compiled/tsconfig-paths/index.js:1:7401)
  at Function.Module._load (node:internal/modules/cjs/loader:1038:27)
  at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)

Following this advice #9987 (comment) and adding a default option for each exported entry solves this problem, and everything ran as expected.

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

Fixes ( I think ):

📌 Resources

roonie007 feat(core, frameworks-express): Add default exports to package.json f…
b1a81024
roonie007 roonie007 requested a review from ThangHuuVu ThangHuuVu 332 days ago
vercel
vercel332 days ago (edited 332 days ago)

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 9:23am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Jun 21, 2024 9:23am
vercel
vercel332 days ago

@roonie007 is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

github-actions github-actions added frameworks
socket-security
socket-security332 days ago

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/broken-link-checker@0.7.8 network Transitive: environment, eval, filesystem, shell, unsafe +100 6.82 MB stevenvachon
npm/class-variance-authority@0.7.0 None +1 15.7 kB joebell93
npm/clsx@2.1.0 None 0 8.46 kB lukeed
npm/postcss@8.4.38 environment, filesystem +3 367 kB ai
npm/react@18.2.0 environment +2 337 kB gnoff
npm/solid-js@1.8.17 None +3 3.32 MB ryansolid
npm/svelte-check@3.6.9 Transitive: environment, eval, filesystem, unsafe +25 10.3 MB svelte-language-tools-deploy
npm/svelte@4.2.15 Transitive: unsafe +12 5.83 MB svelte-admin
npm/tailwind-merge@1.14.0 environment 0 765 kB dcas
npm/tailwindcss@3.4.3 environment, filesystem Transitive: network, shell, unsafe +85 14 MB adamwathan
npm/tsx@4.7.0 Transitive: environment, filesystem, network, shell, unsafe +3 643 kB hirokiosame
npm/typescript@5.2.2 None 0 40.6 MB typescript-bot
npm/typescript@5.3.3 None 0 32 MB typescript-bot
npm/typescript@5.4.4 None 0 32.4 MB typescript-bot
npm/typescript@5.4.5 None 0 32.4 MB typescript-bot
npm/vite@5.2.10 environment, eval, filesystem, network, shell, unsafe +18 50.5 MB vitebot

🚮 Removed packages: npm/@auth/core@0.33.0, npm/@libsql/client@0.6.0, npm/@oddbird/css-anchor-positioning@0.0.5, npm/@sveltejs/adapter-auto@1.0.0-next.91, npm/@types/eslint@8.56.10, npm/@types/react-dom@18.2.18, npm/@types/react@18.2.48, npm/@types/react@18.2.78, npm/algoliasearch@4.23.3, npm/classnames@2.5.1, npm/morgan@1.10.0, npm/next@14.2.3, npm/next@15.0.0-rc.0, npm/nextra-theme-docs@3.0.0-alpha.24, npm/nextra@3.0.0-alpha.24, npm/prisma@5.8.1, npm/pug@3.0.2, npm/react-dom@18.3.1, npm/react-dom@19.0.0-rc-4c2e457c7c-20240522, npm/react@18.3.1, npm/react@19.0.0-rc-4c2e457c7c-20240522, npm/shiki@1.3.0, npm/svelte-check@2.10.2, npm/svelte@4.2.9, npm/tsx@4.7.3, npm/typedoc-plugin-markdown@4.0.0-next.54

View full report↗︎

socket-security
socket-security332 days ago

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Install scripts npm/svelte-preprocess@5.1.4
  • Install script: postinstall
  • Source: echo "[svelte-preprocess] Don't forget to install the preprocessors packages that will be used: sass, stylus, less, postcss & postcss-load-config, coffeescript, pug, etc..."
🚫

View full report↗︎

Next steps

What is an install script?

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

  • @SocketSecurity ignore npm/svelte-preprocess@5.1.4
balazsorban44
balazsorban44 approved these changes on 2024-06-21
balazsorban44 balazsorban44 merged 51a8a064 into main 332 days ago
roonie007 roonie007 deleted the fix-no-exports-main-defined branch 332 days ago

Login to write a write a comment.

Login via GitHub

Assignees
No one assigned
Labels
Milestone