Skip to content

Commit 587ad7b

Browse files
authored
fix(build): declare preload-helper has no side effects (#18057)
1 parent 7d699aa commit 587ad7b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/vite/src/node/plugins/importAnalysisBuild.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
188188
const scriptRel =
189189
modulePreload && modulePreload.polyfill
190190
? `'modulepreload'`
191-
: `(${detectScriptRel.toString()})()`
191+
: `/* @__PURE__ */ (${detectScriptRel.toString()})()`
192192

193193
// There are two different cases for the preload list format in __vitePreload
194194
//
@@ -207,7 +207,7 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
207207
// is appended inside __vitePreload too.
208208
`function(dep) { return ${JSON.stringify(config.base)}+dep }`
209209
const preloadCode = `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};export const ${preloadMethod} = ${preload.toString()}`
210-
return preloadCode
210+
return { code: preloadCode, moduleSideEffects: false }
211211
}
212212
},
213213

0 commit comments

Comments
 (0)