Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@test/builtin-framework-guard-astro",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"build": "vpt print astro build script",
"dev": "vpt print astro dev script"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@test/builtin-framework-guard-no-scripts",
"version": "1.0.0",
"private": true,
"type": "module"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@test/builtin-framework-guard",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"build": "vpt print nuxt build script",
"dev": "vpt print nuxt dev script"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@test/builtin-framework-guard-renamed-script",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"devtools": "nuxt devtools enable",
"make": "nuxt build",
"start": "nuxi dev --host"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# `vp dev` and `vp build` run the bundled Vite CLI. That CLI cannot serve or
# build a project whose framework wraps Vite behind its own CLI. When a Nuxt
# or Astro config file is next to the nearest `package.json`, the two
# commands stop with an error that points at `vp run <command>`. The root of
# this project looks like a Nuxt app, and `astro/` holds an Astro package.
[[case]]
name = "builtin_framework_guard"
vp = ["local", "global"]
skip-platforms = ["windows"]
steps = [
{ argv = ["vp", "dev"], comment = "`vp dev` refuses in a Nuxt project and points at the dev script", continue-on-failure = true },
{ argv = ["vp", "build"], comment = "`vp build` refuses the same way", continue-on-failure = true },
{ argv = ["vp", "dev"], cwd = "src", comment = "the refusal finds the enclosing package from a subdirectory, with the same walk `vp run` uses", continue-on-failure = true },
{ argv = ["vp", "dev"], cwd = "astro", comment = "an Astro config triggers the same refusal", continue-on-failure = true },
{ argv = ["vp", "dev"], cwd = "no-scripts", comment = "without scripts, the hint points at the framework CLI through `vp exec`", continue-on-failure = true },
{ argv = ["vp", "build"], cwd = "no-scripts", comment = "`vp build` gets the same fallback hint", continue-on-failure = true },
{ argv = ["vp", "dev"], cwd = "renamed-script", comment = "a script that runs the framework dev command under another name becomes the hint target", continue-on-failure = true },
{ argv = ["vp", "build"], cwd = "renamed-script", comment = "the build hint finds the renamed build script the same way", continue-on-failure = true },
{ argv = ["vp", "dev", "--config", "vite.config.ts", "--port", "12312312312"], comment = "an explicit --config selects the bundled Vite CLI on purpose, so only the script note prints (the invalid port stops the server immediately)", continue-on-failure = true },
{ argv = ["vp", "run", "dev"], comment = "`vp run dev` runs the dev script that the refusal points at" },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# builtin_framework_guard

## `vp dev`

`vp dev` refuses in a Nuxt project and points at the dev script

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

error: this project uses Nuxt (nuxt.config.ts). `vp dev` runs the bundled Vite CLI, not the Nuxt CLI.
hint: did you mean `vp run dev`?
```

## `vp build`

`vp build` refuses the same way

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

error: this project uses Nuxt (nuxt.config.ts). `vp build` runs the bundled Vite CLI, not the Nuxt CLI.
hint: did you mean `vp run build`?
```

## `cd src && vp dev`

the refusal finds the enclosing package from a subdirectory, with the same walk `vp run` uses

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

error: this project uses Nuxt (nuxt.config.ts). `vp dev` runs the bundled Vite CLI, not the Nuxt CLI.
hint: did you mean `vp run dev`?
```

## `cd astro && vp dev`

an Astro config triggers the same refusal

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

error: this project uses Astro (astro.config.mjs). `vp dev` runs the bundled Vite CLI, not the Astro CLI.
hint: did you mean `vp run dev`?
```

## `cd no-scripts && vp dev`

without scripts, the hint points at the framework CLI through `vp exec`

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

error: this project uses Nuxt (nuxt.config.ts). `vp dev` runs the bundled Vite CLI, not the Nuxt CLI.
hint: run the Nuxt CLI with `vp exec nuxt dev`.
```

## `cd no-scripts && vp build`

`vp build` gets the same fallback hint

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

error: this project uses Nuxt (nuxt.config.ts). `vp build` runs the bundled Vite CLI, not the Nuxt CLI.
hint: run the Nuxt CLI with `vp exec nuxt build`.
```

## `cd renamed-script && vp dev`

a script that runs the framework dev command under another name becomes the hint target

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

error: this project uses Nuxt (nuxt.config.ts). `vp dev` runs the bundled Vite CLI, not the Nuxt CLI.
hint: did you mean `vp run start`? The start script runs `nuxi dev`.
```

## `cd renamed-script && vp build`

the build hint finds the renamed build script the same way

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

error: this project uses Nuxt (nuxt.config.ts). `vp build` runs the bundled Vite CLI, not the Nuxt CLI.
hint: did you mean `vp run make`? The make script runs `nuxt build`.
```

## `vp dev --config vite.config.ts --port 12312312312`

an explicit --config selects the bundled Vite CLI on purpose, so only the script note prints (the invalid port stops the server immediately)

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

note: You are running `vp dev` as a Vite+ built-in command. If you meant to run the dev npm script, use `vpr dev` instead.
error when starting dev server:
Error: No available ports found between 12312312312 and 65535
```

## `vp run dev`

`vp run dev` runs the dev script that the refusal points at

```
VITE+ - The Unified Toolchain for the Web

$ vpt print nuxt dev script ⊘ cache disabled
nuxt dev script
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# builtin_framework_guard

## `vp dev`

`vp dev` refuses in a Nuxt project and points at the dev script

**Exit code:** 1

```
error: this project uses Nuxt (nuxt.config.ts). `vp dev` runs the bundled Vite CLI, not the Nuxt CLI.
hint: did you mean `vp run dev`?
```

## `vp build`

`vp build` refuses the same way

**Exit code:** 1

```
error: this project uses Nuxt (nuxt.config.ts). `vp build` runs the bundled Vite CLI, not the Nuxt CLI.
hint: did you mean `vp run build`?
```

## `cd src && vp dev`

the refusal finds the enclosing package from a subdirectory, with the same walk `vp run` uses

**Exit code:** 1

```
error: this project uses Nuxt (nuxt.config.ts). `vp dev` runs the bundled Vite CLI, not the Nuxt CLI.
hint: did you mean `vp run dev`?
```

## `cd astro && vp dev`

an Astro config triggers the same refusal

**Exit code:** 1

```
error: this project uses Astro (astro.config.mjs). `vp dev` runs the bundled Vite CLI, not the Astro CLI.
hint: did you mean `vp run dev`?
```

## `cd no-scripts && vp dev`

without scripts, the hint points at the framework CLI through `vp exec`

**Exit code:** 1

```
error: this project uses Nuxt (nuxt.config.ts). `vp dev` runs the bundled Vite CLI, not the Nuxt CLI.
hint: run the Nuxt CLI with `vp exec nuxt dev`.
```

## `cd no-scripts && vp build`

`vp build` gets the same fallback hint

**Exit code:** 1

```
error: this project uses Nuxt (nuxt.config.ts). `vp build` runs the bundled Vite CLI, not the Nuxt CLI.
hint: run the Nuxt CLI with `vp exec nuxt build`.
```

## `cd renamed-script && vp dev`

a script that runs the framework dev command under another name becomes the hint target

**Exit code:** 1

```
error: this project uses Nuxt (nuxt.config.ts). `vp dev` runs the bundled Vite CLI, not the Nuxt CLI.
hint: did you mean `vp run start`? The start script runs `nuxi dev`.
```

## `cd renamed-script && vp build`

the build hint finds the renamed build script the same way

**Exit code:** 1

```
error: this project uses Nuxt (nuxt.config.ts). `vp build` runs the bundled Vite CLI, not the Nuxt CLI.
hint: did you mean `vp run make`? The make script runs `nuxt build`.
```

## `vp dev --config vite.config.ts --port 12312312312`

an explicit --config selects the bundled Vite CLI on purpose, so only the script note prints (the invalid port stops the server immediately)

**Exit code:** 1

```
note: You are running `vp dev` as a Vite+ built-in command. If you meant to run the dev npm script, use `vpr dev` instead.
error when starting dev server:
Error: No available ports found between 12312312312 and 65535
```

## `vp run dev`

`vp run dev` runs the dev script that the refusal points at

```
$ vpt print nuxt dev script ⊘ cache disabled
nuxt dev script
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const valid = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
2 changes: 1 addition & 1 deletion docs/guide/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Select a task (↑/↓, Enter to run, Esc to clear):

`build`, `preview`, `lint`, `fmt`, `check`, and `pack` work the same way.

If the project defines that script or task, run it with `vp run <name>`. For example, with a `"dev": "astro dev"` script, `vp run dev` starts Astro, while `vp dev` ignores the script and starts Vite.
If the project defines that script or task, run it with `vp run <name>`. For example, with a `"dev": "astro dev"` script, `vp run dev` starts Astro. In a Nuxt or Astro project, `vp dev` and `vp build` stop with an error that points at `vp run <name>`. Those frameworks run Vite through their own CLI. The bundled Vite CLI cannot serve or build them.

## Caching

Expand Down
2 changes: 2 additions & 0 deletions docs/guide/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ For example:
- `vp test` always runs the built-in Vitest command
- `vp run dev`, `vp run build`, and `vp run test` run the matching `package.json` scripts instead

In a Nuxt or Astro project (a `nuxt.config.*` or `astro.config.*` file next to `package.json`), `vp dev` and `vp build` stop with an error that points at `vp run <name>`. Those frameworks run Vite through their own CLI. The bundled Vite CLI cannot serve or build them.
Comment thread
fengmk2 marked this conversation as resolved.
Outdated

See [Built-in Commands vs Scripts](/guide/run#built-in-commands-vs-scripts) for when to prefer each path.

::: info
Expand Down
Loading
Loading