Skip to content

Commit

Permalink
fix: tree-shake modulepreload polyfill (#9531)
Browse files Browse the repository at this point in the history
  • Loading branch information
caoxiemeihao authored Aug 8, 2022
1 parent 65cf7fb commit 1f11a70
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/vite/src/node/plugins/modulePreloadPolyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export function modulePreloadPolyfillPlugin(config: ResolvedConfig): Plugin {
return ''
}
if (!polyfillString) {
polyfillString =
`const p = ${polyfill.toString()};` + `${isModernFlag}&&p();`
polyfillString = `${isModernFlag}&&(${polyfill.toString()}());`
}
return polyfillString
}
Expand Down

0 comments on commit 1f11a70

Please sign in to comment.