codesandbox / codesandbox/codesandbox-client

Disable preview for a task in the tasks.json

Open
#8,256 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13.6k
Forks
2.4k
Avg merge
6d 19h
Merged PRs (30d)
2

Description

🐛 bug report

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • [ x I agree to follow the Code of Conduct that this project
    adheres to.
  • I have searched the issue tracker for an issue that matches the one I want
    to file, without success.

Description of the problem

I have two tasks, one for the frontend (port:5173) and one for the api server (3002). I've configured my tasks.json without a preview for the api task - but it stills open the preview - how do I disbale that?

How has this issue affected you? What are you trying to accomplish?

Everytime I open this sandbox - I get an error because it opens two previews - one with the error

To Reproduce

The task dev-node doesn't have a preview setting - but still opens a preview for the port it opens (3002)
tasks.json

{
  // These tasks will run in order when initializing your CodeSandbox project.
  "setupTasks": [
    {
      "name": "Install Dependencies",
      "command": "yarn install"
    }
  ],

  // These tasks can be run from CodeSandbox. Running one will open a log in the app.
  "tasks": {
    "dev": {
      "name": "dev",
      "command": "yarn dev",
      "runAtStart": true,
      "preview": {
        "port": 5173
      }
    },
    "dev-node": {
      "name": "dev-node",
      "command": "yarn dev-node",
      "runAtStart": true
    }
  }
}
Link to sandbox: link (optional)

https://codesandbox.io/p/devbox/github/remult/react-vite-express-starter/tree/master/?file=%2F.codesandbox%2Ftasks.json%3A1%2C1-27%2C1

Your Environment
Software Name/Version
Сodesandbox
Browser
Operating System

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the linked sandbox and reviewing its .codesandbox/tasks.json, especially the dev and dev-node task definitions. Trace how task commands and port previews are handled; done means dev still previews port 5173 while dev-node on port 3002 does not open a preview.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.