Skip to content

Commit

Permalink
fix: resolve --root relative to automatic root
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re committed Feb 9, 2023
1 parent b90450c commit 6a52157
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/astro/src/core/dev/restart.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { fileURLToPath, pathToFileURL } from 'url';
import * as vite from 'vite';
import type { AstroSettings } from '../../@types/astro';
import { createSettings, openConfig } from '../config/index.js';
import { createSafeError } from '../errors/index.js';
import { info } from '../logger/core.js';
import { prependForwardSlash, appendForwardSlash } from '../path.js';
import type { Container, CreateContainerParams } from './container';
import { createContainer, isStarted, startContainer } from './container.js';

Expand Down Expand Up @@ -76,8 +78,9 @@ export async function restartContainer({
beforeRestart,
}: RestartContainerParams): Promise<{ container: Container; error: Error | null }> {
const { logging, close, resolvedRoot, settings: existingSettings } = container;
const root = flags.root || resolvedRoot;
container.restartInFlight = true;
// Resolve `flags.root` relative to `resolvedRoot`
const root = flags.root ? fileURLToPath(new URL('.' + prependForwardSlash(appendForwardSlash(flags.root)), pathToFileURL(resolvedRoot))) : resolvedRoot;

if (beforeRestart) {
beforeRestart();
Expand Down

0 comments on commit 6a52157

Please sign in to comment.