File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change
1
+ import fs from 'node:fs'
1
2
import path from 'node:path'
2
3
import type * as http from 'node:http'
3
4
import sirv from 'sirv'
@@ -83,6 +84,13 @@ export async function preview(
83
84
'production' ,
84
85
)
85
86
87
+ const distDir = path . resolve ( config . root , config . build . outDir )
88
+ if ( ! fs . existsSync ( distDir ) ) {
89
+ throw new Error (
90
+ `"${ config . build . outDir } " does not exist. Did you build your project?`
91
+ )
92
+ }
93
+
86
94
const app = connect ( ) as Connect . Server
87
95
const httpServer = await resolveHttpServer (
88
96
config . preview ,
@@ -115,7 +123,6 @@ export async function preview(
115
123
config . base === './' || config . base === '' ? '/' : config . base
116
124
117
125
// static assets
118
- const distDir = path . resolve ( config . root , config . build . outDir )
119
126
const headers = config . preview . headers
120
127
const assetServer = sirv ( distDir , {
121
128
etag : true ,
You can’t perform that action at this time.
0 commit comments