From ceba4c3180b8718d70d70ef74eee75433301d4e9 Mon Sep 17 00:00:00 2001 From: OneNail <31649110+OneNail@users.noreply.github.com> Date: Sat, 26 Jun 2021 02:07:01 +0800 Subject: [PATCH] fix(plugin-legacy): chunk may not exist (#3886) --- packages/plugin-legacy/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/plugin-legacy/index.js b/packages/plugin-legacy/index.js index 63d18954e48eaa..5ef810d212da11 100644 --- a/packages/plugin-legacy/index.js +++ b/packages/plugin-legacy/index.js @@ -303,6 +303,7 @@ function viteLegacyPlugin(options = {}) { }, transformIndexHtml(html, { chunk }) { + if (!chunk) return if (chunk.fileName.includes('-legacy')) { // The legacy bundle is built first, and its index.html isn't actually // emitted. Here we simply record its corresponding legacy chunk.