File tree 2 files changed +9
-2
lines changed
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -342,6 +342,7 @@ async function doBuild(
342
342
const config = await resolveConfig ( inlineConfig , 'build' , 'production' )
343
343
const options = config . build
344
344
const ssr = ! ! options . ssr
345
+ const esm = config . ssr ?. format === 'es' || ! ssr
345
346
const libOptions = options . lib
346
347
347
348
config . logger . info (
@@ -433,8 +434,8 @@ async function doBuild(
433
434
const buildOutputOptions = ( output : OutputOptions = { } ) : OutputOptions => {
434
435
return {
435
436
dir : outDir ,
436
- format : ssr ? 'cjs ' : 'es ' ,
437
- exports : ssr ? 'named ' : 'auto ' ,
437
+ format : esm ? 'es ' : 'cjs ' ,
438
+ exports : esm ? 'auto ' : 'named ' ,
438
439
sourcemap : options . sourcemap ,
439
440
name : libOptions ? libOptions . name : undefined ,
440
441
generatedCode : 'es2015' ,
Original file line number Diff line number Diff line change @@ -239,6 +239,12 @@ export interface SSROptions {
239
239
* Default: 'node'
240
240
*/
241
241
target ?: SSRTarget
242
+
243
+ /**
244
+ * Define the module format for the ssr build.
245
+ * Default: 'cjs'
246
+ */
247
+ format ?: 'es' | 'cjs'
242
248
}
243
249
244
250
export interface ResolveWorkerOptions {
You can’t perform that action at this time.
0 commit comments