fix: skip fields not supported by rolldown for rolldown-vite (#4747)

pull/4758/head
4 months ago committed by GitHub
parent ab0e0cb598
commit 4e3fce40c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,6 +1,7 @@
import fs from 'fs-extra' import fs from 'fs-extra'
import path from 'node:path' import path from 'node:path'
import { fileURLToPath } from 'node:url' import { fileURLToPath } from 'node:url'
import * as vite from 'vite'
import { import {
build, build,
normalizePath, normalizePath,
@ -98,9 +99,12 @@ export async function bundle(
app: path.resolve(APP_PATH, ssr ? 'ssr.js' : 'index.js'), app: path.resolve(APP_PATH, ssr ? 'ssr.js' : 'index.js'),
...input ...input
}, },
// important so that each page chunk and the index export things for each // @ts-ignore skip setting it for rolldown-vite since it doesn't support `preserveEntrySignatures` yet
...(vite.rolldownVersion
? undefined
: // important so that each page chunk and the index export things for each
// other // other
preserveEntrySignatures: 'allow-extension', { preserveEntrySignatures: 'allow-extension' }),
output: { output: {
sanitizeFileName, sanitizeFileName,
...rollupOptions?.output, ...rollupOptions?.output,
@ -118,7 +122,14 @@ export async function bundle(
? `${config.assetsDir}/chunks/ui-custom.[hash].js` ? `${config.assetsDir}/chunks/ui-custom.[hash].js`
: `${config.assetsDir}/chunks/[name].[hash].js` : `${config.assetsDir}/chunks/[name].[hash].js`
}, },
manualChunks(id, ctx) { // @ts-ignore skip setting it for rolldown-vite since it doesn't support `manualChunks`
...(vite.rolldownVersion
? undefined
: {
manualChunks(
id: string,
ctx: Pick<Rollup.PluginContext, 'getModuleInfo'>
) {
// move known framework code into a stable chunk so that // move known framework code into a stable chunk so that
// custom theme changes do not invalidate hash for all pages // custom theme changes do not invalidate hash for all pages
if ( if (
@ -157,6 +168,7 @@ export async function bundle(
} }
} }
}) })
})
} }
} }
}, },

Loading…
Cancel
Save