Skip to content

Commit a10c01d

Browse files
Conditionally generate vendor import map outside cloud builds (#6559)
## Summary - gate vendor import-map generation behind non-cloud distributions - keep cloud bundles slim while preserving prebuilt chunks for desktop/localhost builds - document the conditional to guide future CDN/cache work ## Testing - [ ] DISTRIBUTION=cloud pnpm build - [ ] DISTRIBUTION=desktop pnpm build ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6559-Conditionally-generate-vendor-import-map-outside-cloud-builds-2a06d73d3650819d96a0e2b6c006baf1) by [Unito](https://www.unito.io)
1 parent f38255b commit a10c01d

File tree

1 file changed

+40
-35
lines changed

1 file changed

+40
-35
lines changed

vite.config.mts

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -222,41 +222,46 @@ export default defineConfig({
222222
: [vue()]),
223223
tailwindcss(),
224224
comfyAPIPlugin(IS_DEV),
225-
generateImportMapPlugin([
226-
{
227-
name: 'vue',
228-
pattern: 'vue',
229-
entry: './dist/vue.esm-browser.prod.js'
230-
},
231-
{
232-
name: 'vue-i18n',
233-
pattern: 'vue-i18n',
234-
entry: './dist/vue-i18n.esm-browser.prod.js'
235-
},
236-
{
237-
name: 'primevue',
238-
pattern: /^primevue\/?.*/,
239-
entry: './index.mjs',
240-
recursiveDependence: true
241-
},
242-
{
243-
name: '@primevue/themes',
244-
pattern: /^@primevue\/themes\/?.*/,
245-
entry: './index.mjs',
246-
recursiveDependence: true
247-
},
248-
{
249-
name: '@primevue/forms',
250-
pattern: /^@primevue\/forms\/?.*/,
251-
entry: './index.mjs',
252-
recursiveDependence: true,
253-
override: {
254-
'@primeuix/forms': {
255-
entry: ''
256-
}
257-
}
258-
}
259-
]),
225+
// Skip import-map generation for cloud builds to keep bundle small
226+
...(DISTRIBUTION !== 'cloud'
227+
? [
228+
generateImportMapPlugin([
229+
{
230+
name: 'vue',
231+
pattern: 'vue',
232+
entry: './dist/vue.esm-browser.prod.js'
233+
},
234+
{
235+
name: 'vue-i18n',
236+
pattern: 'vue-i18n',
237+
entry: './dist/vue-i18n.esm-browser.prod.js'
238+
},
239+
{
240+
name: 'primevue',
241+
pattern: /^primevue\/?.*/,
242+
entry: './index.mjs',
243+
recursiveDependence: true
244+
},
245+
{
246+
name: '@primevue/themes',
247+
pattern: /^@primevue\/themes\/?.*/,
248+
entry: './index.mjs',
249+
recursiveDependence: true
250+
},
251+
{
252+
name: '@primevue/forms',
253+
pattern: /^@primevue\/forms\/?.*/,
254+
entry: './index.mjs',
255+
recursiveDependence: true,
256+
override: {
257+
'@primeuix/forms': {
258+
entry: ''
259+
}
260+
}
261+
}
262+
])
263+
]
264+
: []),
260265

261266
Icons({
262267
compiler: 'vue3',

0 commit comments

Comments
 (0)