Skip to content

Commit

Permalink
Don't try to start the api server unless RSC is enabled (#10275)
Browse files Browse the repository at this point in the history
Closes #10274
  • Loading branch information
cannikin authored Mar 22, 2024
1 parent 5c594d3 commit f8c4795
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changesets/10275.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- chore(cli): Don't require `web` argument to `yarn rw serve` for RSC apps (#10265) by @cannikin

Since RSC apps have no api side, just running `yarn rw serve` should serve just the web side automatically, no need to explicitly include the additional `web` argument.
7 changes: 4 additions & 3 deletions packages/cli/src/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const builder = async (yargs) => {

// serve both
if (positionalArgs.length === 1) {
if (!apiSideExists) {
if (!apiSideExists && !getConfig().experimental?.rsc?.enabled) {
console.error(
c.error(
'\n Unable to serve the both sides as no `api` folder exists. Please use `yarn rw serve web` instead. \n',
Expand All @@ -145,9 +145,10 @@ export const builder = async (yargs) => {
process.exit(1)
}

// We need the web side to have been built
// We need the web side (and api side, if it exists) to have been built
if (
!fs.existsSync(path.join(getPaths().api.dist)) ||
(fs.existsSync(path.join(getPaths().api.base)) &&
!fs.existsSync(path.join(getPaths().api.dist))) ||
!fs.existsSync(path.join(getPaths().web.dist), 'index.html')
) {
console.error(
Expand Down

0 comments on commit f8c4795

Please sign in to comment.