Skip to content

Commit 5491143

Browse files
authored
fix(plugin-legacy): fix type errors (#4762)
1 parent 1bd6d56 commit 5491143

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/plugin-legacy/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function viteLegacyPlugin(options = {}) {
181181
/**
182182
* @param {string | ((chunkInfo: import('rollup').PreRenderedChunk) => string)} fileNames
183183
* @param {string?} defaultFileName
184-
* @returns {(chunkInfo: import('rollup').PreRenderedChunk) => string)}
184+
* @returns {string | ((chunkInfo: import('rollup').PreRenderedChunk) => string)}
185185
*/
186186
const getLegacyOutputFileName = (
187187
fileNames,
@@ -559,7 +559,9 @@ async function buildPolyfillChunk(
559559
}
560560
}
561561
})
562-
const polyfillChunk = (Array.isArray(res) ? res[0] : res).output[0]
562+
const _polyfillChunk = Array.isArray(res) ? res[0] : res
563+
if (!('output' in _polyfillChunk)) return
564+
const polyfillChunk = _polyfillChunk.output[0]
563565

564566
// associate the polyfill chunk to every entry chunk so that we can retrieve
565567
// the polyfill filename in index html transform

0 commit comments

Comments
 (0)