Skip to content

Conversation

@martijnvdbrug
Copy link
Collaborator

@martijnvdbrug martijnvdbrug commented Jan 8, 2026

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 create doesnt 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:

  • I have set a clear title
  • My PR is small and contains a single feature
  • I have checked my own PR

👍 Most of the time:

  • I have added or updated test cases
  • I have updated the README if needed

@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docs Ready Ready Preview Jan 8, 2026 10:50am
vendure-storybook Ready Ready Preview, Comment Jan 8, 2026 10:50am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

The 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 host: 'auto' and port: 'auto' instead of the previous host: 'http://localhost' and port: {{ port }} values.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description includes motivation and context but lacks completion of required checklist items, which are all unchecked despite being marked as always-required. Complete the pre-merge checklist by marking items as done or removing unchecked boxes. Consider updating README if this feature impacts setup documentation.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: setting the API URL to 'auto' for newly created projects, which is directly supported by the single-line change in the Vite config template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cb17d8 and 17488d1.

📒 Files selected for processing (1)
  • packages/create/templates/vite.config.hbs
⏰ 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: publish_install (macos-latest, 22.x)
  • GitHub Check: e2e tests (24.x, mariadb)
  • GitHub Check: e2e tests (24.x, mysql)
  • GitHub Check: e2e tests (22.x, postgres)
  • GitHub Check: e2e tests (22.x, sqljs)
  • GitHub Check: e2e tests (24.x, postgres)
  • GitHub Check: build (24.x)
  • GitHub Check: e2e tests (24.x, sqljs)
  • GitHub Check: e2e tests (20.x, mariadb)
  • GitHub Check: e2e tests (20.x, postgres)
  • GitHub Check: e2e tests (22.x, mysql)
  • GitHub Check: e2e tests (20.x, sqljs)
  • GitHub Check: e2e tests (20.x, mysql)
  • GitHub Check: codegen / codegen
  • GitHub Check: e2e tests (22.x, mariadb)
  • GitHub Check: build (20.x)
  • GitHub Check: unit tests (22.x)
  • GitHub Check: build (22.x)
  • GitHub Check: unit tests (20.x)
  • GitHub Check: unit tests (24.x)
🔇 Additional comments (1)
packages/create/templates/vite.config.hbs (1)

19-19: The 'auto' configuration for API host and port is correct and uses documented defaults.

The change from explicit localhost configuration to host: 'auto' and port: 'auto' is well-founded. These are the officially documented default values for the vendureDashboardPlugin API configuration, and they enable automatic API URL discovery at runtime using the browser's window.location.hostname and window.location.port. This improves deployment flexibility by removing hardcoded localhost assumptions.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 1364d09 and 9cb17d8.

📒 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' and port: '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: pathToFileURL automatically 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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

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

Successfully merging this pull request may close these issues.

1 participant