Azure / static-web-apps-cli

Azure Static Web Apps CLI ✨
https://aka.ms/swa/cli-local-development
MIT License
583 stars 110 forks source link

swa-cli.config.json "run" field <undefined>when "npm run vite:dev". Vite never runs #800

Open hthaigler opened 4 months ago

hthaigler commented 4 months ago

Before filing this issue, please ensure you're using the latest CLI by running swa --version and comparing to the latest version on npm.

Are you accessing the CLI from the default port :4280 ?

[ ] No, I am using a different port number (--port) and accessing the CLI from that port [✅] (https://emojipedia.org/check-mark-button) Yes, I am accessing the CLI from port :4280

Make sure you are accessing the URL printed in the console when running swa start!

ℹ️ NOTE: Make sure to enable debug logs when running any swa commands using --verbose=silly

Describe the bug A clear and concise description of what the bug is.

When running swa start the webapp frontend is never run. When looking at the logs, the run command is . The cli times out waiting for http://localhost:3000 since the run command is undefined and the vite is never run.

swa-cli.config.json

{
    "$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
    "configurations": {
        "bgpreconbasecamp": {
            "appLocation": "webapp",
            "outputLocation": "dist",
            "appBuildCommand": "npm run vite:build",
            "run": "npm run vite:dev",
            "appDevserverUrl": "http://localhost:3000"
        }
    }
}

To Reproduce Steps to reproduce the behavior:

  1. Go to swa-cli.config.json and copy in json object above.
  2. Type in command swa start --verbose=silly
  3. Scroll down to logs
  4. See error:
    - commands:
    - swa: node "C:\Users\<USER>\AppData\Roaming\nvm\v18.19.0\node_modules\@azure\static-web-apps-cli\dist\msha\server.js"
    - api: <undefined>
    - dataApi: <undefined>
    - run: <undefined>

Expected behavior A clear and concise description of what you expected to happen.

Frontend should run with command npm run vite:dev and serve to http://localhost:3000

Desktop (please complete the following information):