From 097abddbb92657ce8096efd6b17e5674aebe947e Mon Sep 17 00:00:00 2001 From: Wout Mertens Date: Fri, 21 Jun 2024 01:17:38 +0200 Subject: [PATCH] fix(dev): qrl parsing during dev mode (#6584) --- packages/qwik/src/optimizer/src/plugins/plugin.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/qwik/src/optimizer/src/plugins/plugin.ts b/packages/qwik/src/optimizer/src/plugins/plugin.ts index de9bc95dce8..7d835a968af 100644 --- a/packages/qwik/src/optimizer/src/plugins/plugin.ts +++ b/packages/qwik/src/optimizer/src/plugins/plugin.ts @@ -469,14 +469,14 @@ export function createPlugin(optimizerOptions: OptimizerOptions = {}) { if (!(id.startsWith('.') || path.isAbsolute(id))) { return; } - if (opts.target === 'ssr') { - const match = /^([^?]*)\?_qrl_parent=(.*)/.exec(id); + if (opts.target === 'ssr' && !isSSR) { + // possibly dev mode request from the browser + const match = /^([^?]*)\?_qrl_parent=(.*)/.exec(decodeURIComponent(id)); if (match) { // ssr mode asking for a client qrl, this will fall through to the devserver // building here via ctx.load doesn't seem to work (target is always ssr?) // eslint-disable-next-line prefer-const let [, qrlId, parentId] = match; - parentId = decodeURIComponent(parentId); // If the parent is not in root (e.g. pnpm symlink), the qrl also isn't if (parentId.startsWith(opts.rootDir)) { qrlId = `${opts.rootDir}${qrlId}`; @@ -592,7 +592,7 @@ export function createPlugin(optimizerOptions: OptimizerOptions = {}) { id: string, transformOpts: Parameters>[2] = {} ): Promise { - if (id.startsWith('\0') || id.startsWith('/@fs/')) { + if (id.startsWith('\0')) { return; } const isSSR = !!transformOpts.ssr;