Skip to content

Commit e9d0689

Browse files
committed
refactor: use VITE_COMMANDS allowlist with unset fallback to true
1 parent 4cf5eaa commit e9d0689

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/cli/src/__tests__/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test.each(['dev', 'build', 'test', 'preview'])(
7272
},
7373
);
7474

75-
test.each(['lint', 'fmt', 'check', 'pack', 'install'])(
75+
test.each(['lint', 'fmt', 'check', 'pack', 'install', 'run'])(
7676
'defineConfig skips plugins factory when VP_COMMAND is %s',
7777
(cmd) => {
7878
process.env.VP_COMMAND = cmd;

packages/cli/src/define-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ export function defineConfig(config: VPUserConfigExport): VPUserConfigExport {
6868
return viteDefineConfig(config as UserConfig);
6969
}
7070

71-
const NON_VITE_COMMANDS = new Set(['lint', 'fmt', 'check', 'pack', 'install']);
71+
const VITE_COMMANDS = new Set(['dev', 'build', 'test', 'preview']);
7272

7373
function shouldLoadPlugins(): boolean {
7474
const cmd = process.env.VP_COMMAND;
7575
if (!cmd) {
7676
return true;
7777
}
78-
return !NON_VITE_COMMANDS.has(cmd);
78+
return VITE_COMMANDS.has(cmd);
7979
}
8080

8181
function resolvePlugins(plugins: PluginOption[] | PluginsFactory): PluginOption[] {

0 commit comments

Comments
 (0)