Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid main/module/exports in package json #6

Closed
yharaskrik opened this issue Nov 19, 2024 · 3 comments
Closed

Invalid main/module/exports in package json #6

yharaskrik opened this issue Nov 19, 2024 · 3 comments

Comments

@yharaskrik
Copy link

Trying to run with vite-node causes this error. Seems like maybe the package json isn't quite right?

It looks like the published version is missing the file in the module field

"module": "./dist/index.mjs",

3:50:12 PM [vite] Pre-transform error: Failed to resolve entry for package "@upstash/semantic-cache". The package may have incorrect main/module/exports specified in its package.json.
file:///Users/jaybell/.npm/_npx/f2342a4b64a2bc92/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:46637
  const err = new Error(
              ^

Error: Failed to resolve entry for package "@upstash/semantic-cache". The package may have incorrect main/module/exports specified in its package.json.
    at packageEntryFailure (file:///Users/jaybell/.npm/_npx/f2342a4b64a2bc92/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:46637:15)
    at resolvePackageEntry (file:///Users/jaybell/.npm/_npx/f2342a4b64a2bc92/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:46634:3)
    at tryNodeResolve (file:///Users/jaybell/.npm/_npx/f2342a4b64a2bc92/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:46450:16)
    at ResolveIdContext.resolveId (file:///Users/jaybell/.npm/_npx/f2342a4b64a2bc92/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:46200:19)
    at PluginContainer.resolveId (file:///Users/jaybell/.npm/_npx/f2342a4b64a2bc92/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:49015:17)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at TransformPluginContext.resolve (file:///Users/jaybell/.npm/_npx/f2342a4b64a2bc92/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:49175:15)
    at normalizeUrl (file:///Users/jaybell/.npm/_npx/f2342a4b64a2bc92/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:64034:26)
    at file:///Users/jaybell/.npm/_npx/f2342a4b64a2bc92/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:64173:39
    at async Promise.all (index 3) {

@yharaskrik
Copy link
Author

If i remove the module prop from the package.json it works.

@ytkimirti
Copy link
Contributor

Yes you are right, I will open a PR for fixing this asap

ytkimirti added a commit that referenced this issue Nov 20, 2024
This option also changes the outputs of tsup. So it does not output
index.mjs file but instead index.js and index.cjs files. This breaks esm
imports
@ytkimirti
Copy link
Contributor

Hey @yharaskrik, we published a new version. Can you try bumping to 1.0.5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants