Skip to content

Commit

Permalink
feat: expose preview method (#5014)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Sep 24, 2021
1 parent ac55755 commit 9885656
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vite/src/node/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './config'
export { createServer, searchForWorkspaceRoot } from './server'
export { preview } from './preview'
export { build } from './build'
export { optimizeDeps } from './optimizer'
export { send } from './server/send'
Expand Down
6 changes: 6 additions & 0 deletions packages/vite/src/node/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ import { proxyMiddleware } from './server/middlewares/proxy'
import { printServerUrls } from './logger'
import { resolveHostname } from './utils'

/**
* Starts the Vite server in preview mode, to simulate a production deployment
* @param config - the resolve Vite config
* @param serverOptions - what host and port to use
* @experimental
*/
export async function preview(
config: ResolvedConfig,
serverOptions: Pick<ServerOptions, 'port' | 'host'>
Expand Down

0 comments on commit 9885656

Please sign in to comment.