From 9127a65a4d8e252ec90c2f897783602878894085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B2=92=E7=B2=92=E6=A9=99?= Date: Fri, 27 Aug 2021 16:01:33 +0800 Subject: [PATCH] fix type errors fix multiple typecheck error from typescript --- packages/plugin-legacy/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/plugin-legacy/index.js b/packages/plugin-legacy/index.js index c91286befdd216..a5afc961be6933 100644 --- a/packages/plugin-legacy/index.js +++ b/packages/plugin-legacy/index.js @@ -177,7 +177,7 @@ function viteLegacyPlugin(options = {}) { /** * @param {string | ((chunkInfo: import('rollup').PreRenderedChunk) => string)} fileNames * @param {string?} defaultFileName - * @returns {(chunkInfo: import('rollup').PreRenderedChunk) => string)} + * @returns {string | ((chunkInfo: import('rollup').PreRenderedChunk) => string)} */ const getLegacyOutputFileName = ( fileNames, @@ -544,7 +544,9 @@ async function buildPolyfillChunk( } } }) - const polyfillChunk = (Array.isArray(res) ? res[0] : res).output[0] + const _polyfillChunk = Array.isArray(res) ? res[0] : res + if (!('output' in _polyfillChunk)) return + const polyfillChunk = _polyfillChunk.output[0] // associate the polyfill chunk to every entry chunk so that we can retrieve // the polyfill filename in index html transform