Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(qwik): Incorrect module reference in inlinedQrl #5375

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/qwik/src/optimizer/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ export function createPlugin(optimizerOptions: OptimizerOptions = {}) {
}
const deps = new Set<string>();
for (const mod of newOutput.modules) {
if (mod.isEntry) {
if (isTransformedFile(mod)) {
const key = normalizePath(path.join(srcDir, mod.path));
currentOutputs.set(key, [mod, id]);
deps.add(key);
Expand Down Expand Up @@ -669,7 +669,7 @@ export function createPlugin(optimizerOptions: OptimizerOptions = {}) {

results.set(normalizedID, clientNewOutput);
for (const mod of clientNewOutput.modules) {
if (mod.isEntry) {
if (isTransformedFile(mod)) {
const key = normalizePath(path.join(srcDir, mod.path));
ctx.addWatchFile(key);
transformedOutputs.set(key, [mod, id]);
Expand All @@ -686,7 +686,7 @@ export function createPlugin(optimizerOptions: OptimizerOptions = {}) {
await ctx.load({ id });
}

const module = newOutput.modules.find((m) => !m.isEntry)!;
const module = newOutput.modules.find((mod) => !isTransformedFile(mod))!;
return {
code: module.code,
map: module.map,
Expand Down Expand Up @@ -837,6 +837,10 @@ const insideRoots = (ext: string, dir: string, srcDir: string | null, vendorRoot
return false;
};

function isTransformedFile(mod: TransformModule) {
return mod.isEntry || mod.hook;
}

export function parseId(originalId: string) {
const [pathId, query] = originalId.split('?');
const queryStr = query || '';
Expand Down
Loading