Skip to content

Commit ee5f86d

Browse files
committed
fix: ssr entry names
1 parent 79f1fea commit ee5f86d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/vite/src/node/build.ts

+12-10
Original file line numberDiff line numberDiff line change
@@ -670,20 +670,22 @@ export async function build(
670670
// config.packageCache,
671671
// )
672672
// : path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
673-
entryFileNames: libOptions
674-
? `[name]-[hash].${jsExt}`
675-
: path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
673+
entryFileNames: ssr
674+
? `[name].${jsExt}`
675+
: libOptions
676+
? `[name]-[hash].${jsExt}`
677+
: path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
676678
chunkFileNames: libOptions
677679
? `[name]-[hash].${jsExt}`
678680
: path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
679681
assetFileNames: libOptions
680682
? `[name].[ext]`
681683
: path.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
682684
// inlineDynamicImports:
683-
// output.format === 'umd' ||
684-
// output.format === 'iife' ||
685-
// (ssrWorkerBuild &&
686-
// (typeof input === 'string' || Object.keys(input).length === 1)),
685+
// output.format === 'umd' ||
686+
// output.format === 'iife' ||
687+
// (ssrWorkerBuild &&
688+
// (typeof input === 'string' || Object.keys(input).length === 1)),
687689
...output,
688690
}
689691
}
@@ -844,7 +846,7 @@ function resolveOutputJsExtension(
844846
type: string = 'commonjs',
845847
): JsExt {
846848
if (type === 'module') {
847-
return format === 'cjs' /* || format === 'umd' */ ? 'cjs' :'js'
849+
return format === 'cjs' /* || format === 'umd' */ ? 'cjs' : 'js'
848850
} else {
849851
return format === 'es' ? 'mjs' : 'js'
850852
}
@@ -894,7 +896,7 @@ export function resolveBuildOutputs(
894896
Object.values(libOptions.entry).length > 1
895897
const libFormats =
896898
libOptions.formats ||
897-
(libHasMultipleEntries ? ['es', 'cjs'] : ['es', /* 'umd' */])
899+
(libHasMultipleEntries ? ['es', 'cjs'] : ['es' /* 'umd' */])
898900

899901
if (!Array.isArray(outputs)) {
900902
// if (libFormats.includes('umd') || libFormats.includes('iife')) {
@@ -1236,7 +1238,7 @@ export function createToImportMetaURLBasedRelativeRuntime(
12361238
format: InternalModuleFormat,
12371239
isWorker: boolean,
12381240
): (filename: string, importer: string) => { runtime: string } {
1239-
const formatLong = isWorker && format === 'iife' ? 'worker-iife' : format
1241+
const formatLong = isWorker && format === 'iife' ? 'worker-iife' : format
12401242
const toRelativePath = customRelativeUrlMechanisms[formatLong]
12411243
return (filename, importer) => ({
12421244
runtime: toRelativePath(

0 commit comments

Comments
 (0)