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

vite error: Failed to resolve entry for package "@mercurjs/http-client" #37

Open
NicolasGorga opened this issue Dec 20, 2024 · 7 comments

Comments

@NicolasGorga
Copy link

After following the quickstart and correctly creating the db, running migration and seeding, after running 'yarn dev' from the main and navigating to 'localhost:7001' i get a Vite error, regarding the http-client package not resolving correctly. Also, if i check VS Code intellisense, it also shows a red underlining, not knowing where to grab it. Note that the server is started correctly and i can navigate to Admin panel, but not the Vendor one.

Complete log:

`E:\training\medusa\mercur>yarn dev
yarn run v1.22.21
$ turbo run dev
turbo 2.3.3

• Packages in scope: @mercurjs/http-client, medusa-starter-default, vendor
• Running dev in 3 packages
• Remote caching disabled
medusa-starter-default:dev: cache bypass, force executing e146ac122b6cc0f8
vendor:dev: cache bypass, force executing 52b904a92095cc28
vendor:dev: yarn run v1.22.21
medusa-starter-default:dev: yarn run v1.22.21
medusa-starter-default:dev: $ medusa develop --types=false
vendor:dev: $ vite --port 7001
vendor:dev:
vendor:dev: VITE v6.0.2 ready in 254 ms
vendor:dev:
vendor:dev: ➜ Local: http://localhost:7001/
vendor:dev: ➜ Network: use --host to expose
medusa-starter-default:dev: info: Watching filesystem to reload dev server on file change
medusa-starter-default:dev: info: Skipping instrumentation registration. No register function found.
medusa-starter-default:dev: redisUrl not found. A fake redis instance will be used.
medusa-starter-default:dev: warn: Local Event Bus installed. This is not recommended for production.
medusa-starter-default:dev: info: Locking module: Using "in-memory" as default.
medusa-starter-default:dev: info: No job to load from E:\training\medusa\mercur\node_modules@medusajs\medusa\dist\jobs. skipped.
medusa-starter-default:dev: - Creating server
medusa-starter-default:dev: ✔ Server is ready on http://localhost:9000 – 2ms
medusa-starter-default:dev: info: Admin URL → http://localhost:9000/app
vendor:dev: 11:15:26 AM [vite] Internal server error: Failed to resolve entry for package "@mercurjs/http-client". The package may have incorrect main/module/exports specified in its package.json.
vendor:dev: Plugin: vite:import-analysis
vendor:dev: File: E:/training/medusa/mercur/apps/vendor/src/entities/seller/model.ts:2:54
vendor:dev: 1 | import { queryKeysFactory } from "@/shared/lib";
vendor:dev: 2 | import { vendorCreateSeller, vendorGetSellerMe } from "@mercurjs/http-client";
vendor:dev: | ^
vendor:dev: 3 | import {
vendor:dev: 4 | useMutation,
vendor:dev: at packageEntryFailure (file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:16287:15)
vendor:dev: at resolvePackageEntry (file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:16284:3)
vendor:dev: at tryNodeResolve (file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:16149:18)
vendor:dev: at ResolveIdContext.resolveId (file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:15934:19)
vendor:dev: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
vendor:dev: at async EnvironmentPluginContainer.resolveId (file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:46929:22)
vendor:dev: at async TransformPluginContext.resolve (file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:47089:15)
vendor:dev: at async normalizeUrl (file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:45419:26)
vendor:dev: at async file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:45550:39
vendor:dev: at async Promise.all (index 1)
vendor:dev: at async TransformPluginContext.transform (file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:45477:7)
vendor:dev: at async EnvironmentPluginContainer.transform (file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:47009:18)
vendor:dev: at async loadAndTransform (file:///E:/training/medusa/mercur/apps/vendor/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:40848:27)
vendor:dev: 11:15:26 AM [vite] (client) Pre-transform error: Failed to resolve entry for package "@mercurjs/http-client". The package may have incorrect main/module/exports specified in its package.json.
vendor:dev: Plugin: vite:import-analysis
vendor:dev: File: E:/training/medusa/mercur/apps/vendor/src/entities/seller/model.ts:2:54
vendor:dev: 1 | import { queryKeysFactory } from "@/shared/lib";
vendor:dev: 2 | import { vendorCreateSeller, vendorGetSellerMe } from "@mercurjs/http-client";
vendor:dev: | ^
vendor:dev: 3 | import {
vendor:dev: 4 | useMutation,`

@vholik
Copy link
Collaborator

vholik commented Dec 23, 2024

Thanks for feedback. I have just added information about codegen in the README.

  1. Run codegen command to build http-client package
yarn codegen
  1. Start monorepo in dev mode
yarn dev

Currently we are developing vendor dashboard so you can skip these commands, go to the backend folder and run medusa in dev mode

cd apps/backend
yarn dev

@benqSzaw
Copy link

benqSzaw commented Jan 1, 2025

Running the codegen command didn't solve the problem and instead deleted all the vendor types in mercure/packages/http-client/codegen/types.

@bshah007
Copy link

bshah007 commented Jan 4, 2025

@benqSzaw @vholik Same thing happened on my side as well all the vendor types in mercure/packages/http-client/codegen/types are missing after yarn codegen command.

@LukaszMielczarek
Copy link

LukaszMielczarek commented Jan 8, 2025

For me running 'yarn codegen' caused files in '/packages/http-client/codegen' to be changed i.e
i.e packages/http-client/codegen/index.ts

/**
 * Generated by orval v7.4.0 🍺
 * Do not edit manually.
 * Medusa API
 * OpenAPI spec version: 1.0.0
 */
import type {
  400ErrorResponse,
  500ErrorResponse,
  AdminApiKeyResponse,
  ...

@excho0
Copy link

excho0 commented Jan 9, 2025

For me running 'yarn codegen' caused files in '/packages/http-client/codegen' to be changed i.e i.e packages/http-client/codegen/index.ts

/**
 * Generated by orval v7.4.0 🍺
 * Do not edit manually.
 * Medusa API
 * OpenAPI spec version: 1.0.0
 */
import type {
  400ErrorResponse,
  500ErrorResponse,
  AdminApiKeyResponse,
  ...

For me as well

@vholik
Copy link
Collaborator

vholik commented Jan 15, 2025

We have migrated from using orval to using swagger-typescript-api due to generated type errors. The only thing you need to do is build the http-client package using the yarn build command, as type generation has already been addressed.

@Simbalala
Copy link

Simbalala commented Jan 22, 2025

Hello,

I don't hunderstand how start vendor panel i have

(intermediate value).auth.postSellerTypeAuthProvider is not a function
(intermediate value).auth.postSellerTypeAuthProviderRegister is not a function

The packages is not link correctely ?

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

7 participants