Skip to content

Commit

Permalink
fix(dev): qrl parsing during dev mode (#6584)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmertens authored Jun 20, 2024
1 parent 59a45ab commit 097abdd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/qwik/src/optimizer/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down Expand Up @@ -592,7 +592,7 @@ export function createPlugin(optimizerOptions: OptimizerOptions = {}) {
id: string,
transformOpts: Parameters<Extract<Plugin['transform'], Function>>[2] = {}
): Promise<TransformResult> {
if (id.startsWith('\0') || id.startsWith('/@fs/')) {
if (id.startsWith('\0')) {
return;
}
const isSSR = !!transformOpts.ssr;
Expand Down

0 comments on commit 097abdd

Please sign in to comment.