From 171f2fbe0afe09eeb49f5f29f9ecd845c39a8401 Mon Sep 17 00:00:00 2001 From: sapenlei <2503404258gl@gmail.com> Date: Fri, 7 Feb 2025 12:50:30 +0800 Subject: [PATCH] fix(legacy): warn if plugin-legacy is passed to `worker.plugins` (#19079) --- packages/plugin-legacy/src/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index f8f271aa0f18d2..32d3ba8b0e6c84 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -267,6 +267,13 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { ), ) } + if (config.isWorker) { + config.logger.warn( + colors.yellow( + `plugin-legacy should not be passed to 'worker.plugins'. Pass to 'plugins' instead. Note that generating legacy chunks for workers are not supported by plugin-legacy.`, + ), + ) + } }, }