diff --git a/packages/astro/src/compiler/transform/head.ts b/packages/astro/src/compiler/transform/head.ts index 58b14c451..bafe3e341 100644 --- a/packages/astro/src/compiler/transform/head.ts +++ b/packages/astro/src/compiler/transform/head.ts @@ -58,26 +58,27 @@ export default function (opts: TransformOptions): Transformer { if (isHmrEnabled) { const { hmrPort } = opts.compileOptions; - children.push({ - type: 'Element', - name: 'script', - attributes: [], - children: [ - { type: 'Text', data: `window.HMR_WEBSOCKET_URL = 'ws://localhost:${hmrPort}'`, start: 0, end: 0 } - ], - start: 0, - end: 0 - }, { - type: 'Element', - name: 'script', - attributes: [ - { type: 'Attribute', name: 'type', value: [{ type: 'Text', data: 'module', start: 0, end: 0 }], start: 0, end: 0 }, - { type: 'Attribute', name: 'src', value: [{ type: 'Text', data: '/_snowpack/hmr-client.js', start: 0, end: 0 }], start: 0, end: 0 }, - ], - children: [], - start: 0, - end: 0 - }) + children.push( + { + type: 'Element', + name: 'script', + attributes: [], + children: [{ type: 'Text', data: `window.HMR_WEBSOCKET_URL = 'ws://localhost:${hmrPort}'`, start: 0, end: 0 }], + start: 0, + end: 0, + }, + { + type: 'Element', + name: 'script', + attributes: [ + { type: 'Attribute', name: 'type', value: [{ type: 'Text', data: 'module', start: 0, end: 0 }], start: 0, end: 0 }, + { type: 'Attribute', name: 'src', value: [{ type: 'Text', data: '/_snowpack/hmr-client.js', start: 0, end: 0 }], start: 0, end: 0 }, + ], + children: [], + start: 0, + end: 0, + } + ); } head.children = head.children ?? []; head.children.push(...children); diff --git a/packages/astro/src/runtime.ts b/packages/astro/src/runtime.ts index 1acf1685e..b350da596 100644 --- a/packages/astro/src/runtime.ts +++ b/packages/astro/src/runtime.ts @@ -264,7 +264,7 @@ interface CreateSnowpackOptions { env: Record; mode: RuntimeMode; resolvePackageUrl?: (pkgName: string) => Promise; - target: 'frontend'|'backend'; + target: 'frontend' | 'backend'; } const DEFAULT_HMR_PORT = 12321; @@ -284,11 +284,11 @@ async function createSnowpack(astroConfig: AstroConfig, options: CreateSnowpackO resolvePackageUrl?: (s: string) => Promise; renderers?: { name: string; client: string; server: string }[]; astroConfig: AstroConfig; - hmrPort?: number + hmrPort?: number; } = { astroConfig, resolvePackageUrl, - hmrPort: isHmrEnabled ? DEFAULT_HMR_PORT : undefined + hmrPort: isHmrEnabled ? DEFAULT_HMR_PORT : undefined, }; const mountOptions = {