Skip to content

Commit 164cf7b

Browse files
committed
fix: ssr entry names
1 parent df84d54 commit 164cf7b

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/vite/src/node/build.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -671,20 +671,22 @@ export async function build(
671671
// config.packageCache,
672672
// )
673673
// : path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
674-
entryFileNames: libOptions
675-
? `[name]-[hash].${jsExt}`
676-
: path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
674+
entryFileNames: ssr
675+
? `[name].${jsExt}`
676+
: libOptions
677+
? `[name]-[hash].${jsExt}`
678+
: path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
677679
chunkFileNames: libOptions
678680
? `[name]-[hash].${jsExt}`
679681
: path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
680682
assetFileNames: libOptions
681683
? `[name].[ext]`
682684
: path.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
683685
// inlineDynamicImports:
684-
// output.format === 'umd' ||
685-
// output.format === 'iife' ||
686-
// (ssrWorkerBuild &&
687-
// (typeof input === 'string' || Object.keys(input).length === 1)),
686+
// output.format === 'umd' ||
687+
// output.format === 'iife' ||
688+
// (ssrWorkerBuild &&
689+
// (typeof input === 'string' || Object.keys(input).length === 1)),
688690
...output,
689691
}
690692
}
@@ -845,7 +847,7 @@ function resolveOutputJsExtension(
845847
type: string = 'commonjs',
846848
): JsExt {
847849
if (type === 'module') {
848-
return format === 'cjs' /* || format === 'umd' */ ? 'cjs' :'js'
850+
return format === 'cjs' /* || format === 'umd' */ ? 'cjs' : 'js'
849851
} else {
850852
return format === 'es' ? 'mjs' : 'js'
851853
}
@@ -895,7 +897,7 @@ export function resolveBuildOutputs(
895897
Object.values(libOptions.entry).length > 1
896898
const libFormats =
897899
libOptions.formats ||
898-
(libHasMultipleEntries ? ['es', 'cjs'] : ['es', /* 'umd' */])
900+
(libHasMultipleEntries ? ['es', 'cjs'] : ['es' /* 'umd' */])
899901

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

0 commit comments

Comments
 (0)