-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(create): Set api url to auto for newly created projects
#4102
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
base: master
Are you sure you want to change the base?
feat(create): Set api url to auto for newly created projects
#4102
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe pull request updates the default Vendure Admin API configuration in the Vite template. The dashboard plugin configuration has been modified to replace explicit localhost host and port settings with automatic discovery mode, using 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @packages/create/templates/vite.config.template.mts:
- Around line 27-33: The alias entry currently uses resolve(__dirname,
'./src/gql/graphql.ts') which breaks in ESM; update the alias for '@/gql' to
compute the path from import.meta.url instead (e.g., derive a dirname via
fileURLToPath(new URL(..., import.meta.url)) or use URL + fileURLToPath) and
then pass that resolved absolute path to resolve; change the reference in the
Vite config where '@/gql' is defined so it no longer relies on __dirname but
uses import.meta.url-derived path resolution.
- Around line 7-10: The template uses the CommonJS global __dirname inside
vite.config.template.mts (see base, build, outDir, join), which is undefined in
ES modules; replace usage by deriving the directory from import.meta.url (e.g.,
via fileURLToPath + dirname or using new URL) and pass that resolved path to
join/outDir so outDir points to dist/dashboard at runtime.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/create/templates/vite.config.template.mts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
- GitHub Check: e2e tests (20.x, mysql)
- GitHub Check: e2e tests (20.x, postgres)
- GitHub Check: e2e tests (24.x, mysql)
- GitHub Check: e2e tests (20.x, mariadb)
- GitHub Check: e2e tests (22.x, mariadb)
- GitHub Check: e2e tests (20.x, sqljs)
- GitHub Check: e2e tests (24.x, mariadb)
- GitHub Check: unit tests (24.x)
- GitHub Check: unit tests (22.x)
- GitHub Check: unit tests (20.x)
- GitHub Check: build (22.x)
- GitHub Check: publish_install (macos-latest, 20.x)
- GitHub Check: publish_install (ubuntu-latest, 20.x)
- GitHub Check: publish_install (ubuntu-latest, 22.x)
- GitHub Check: publish_install (windows-latest, 24.x)
- GitHub Check: publish_install (ubuntu-latest, 24.x)
- GitHub Check: publish_install (macos-latest, 22.x)
- GitHub Check: publish_install (windows-latest, 22.x)
- GitHub Check: publish_install (windows-latest, 20.x)
- GitHub Check: publish_install (macos-latest, 24.x)
🔇 Additional comments (3)
packages/create/templates/vite.config.template.mts (3)
1-4: LGTM!The imports are appropriate for a Vite configuration file with Vendure dashboard integration.
19-19: Excellent: API auto-detection aligns with PR objectives.Setting
host: 'auto'andport: 'auto'correctly implements the PR goal to auto-detect the API URL based on where the dashboard is served, matching the Angular dashboard behavior.
17-17: No issue:pathToFileURLautomatically resolves relative paths to absolute paths before converting to a file URL, as documented in the official Node.js API. The code is correct as written.Likely an incorrect or invalid review comment.
|



Description
IMO it makes sense to make the new React Dashboard resolve the API url based on where it is served from, because it aligns with how the Angular dashboard worked.
It was a bit frustrating to find out that a project created with
vendure createdoesnt work out of the box after being deployed, and also couldn't find anything on this topic in the docs.Related Discord questions:
Checklist
📌 Always:
👍 Most of the time: