fix the preview command base URL (#1897)

This commit is contained in:
Fred K. Schott 2021-11-19 11:36:11 -08:00 committed by GitHub
parent 1acedb5ce8
commit e373a379a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,7 +23,7 @@ interface PreviewServer {
/** The primary dev action */ /** The primary dev action */
export default async function preview(config: AstroConfig, { logging }: PreviewOptions): Promise<PreviewServer> { export default async function preview(config: AstroConfig, { logging }: PreviewOptions): Promise<PreviewServer> {
const startServerTime = performance.now(); const startServerTime = performance.now();
const base = config.buildOptions.site ? new URL(config.buildOptions.site).pathname + '/' : '/'; const base = config.buildOptions.site ? new URL(config.buildOptions.site).pathname : '/';
// Create the preview server, send static files out of the `dist/` directory. // Create the preview server, send static files out of the `dist/` directory.
const server = http.createServer((req, res) => { const server = http.createServer((req, res) => {