-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: better alias resolution #14413
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: better alias resolution #14413
Conversation
🦋 Changeset detectedLatest commit: c6144ff The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
After I upgraded to 2.5.1, this broke one of my Svelte packages: It left files with |
|
Please provide a reproduction. The Pasting the import that is left untouched should be enough |
|
@dummdidumm I'm having issues with this version of With the following branch: if you run: pnpm i && pnpm devand then navigate to Downgrading to 2.5.0 fixes this. |
|
The problem wasn't that paths were unmodified in the build, but the opposite: A relative path like |
|
@DePasqualeOrg please provide the full code of the offending file that contains the import path. I can reproduce @huntabyte's problem ( |
* fix: handle `import/export * (as ...)` when resolving aliases #14413 (comment) * while we're here
|
Sorry, I was wrong. The problem is in fact that this path remains unmodified in the build:
I don't have any custom alias set up. Full code of the file: <!-- Based on https://www.shadcn-svelte.com/docs/components/dialog -->
<script lang="ts">
import type { SubmitFunction } from '@sveltejs/kit';
import * as Dialog from '$lib/components/ui/dialog/index.js';
import { enhance } from '$app/forms';
import DialogFooter from '$lib/components/dialog/DialogFooter.svelte';
import type { Snippet } from 'svelte';
interface Props {
open?: boolean;
title?: string;
description?: string;
message?: string;
action?: string | null;
loading?: boolean;
showCancelButton?: boolean;
confirmButtonText: string;
confirmButtonVariant?: 'link' | 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost';
submitFunction?: SubmitFunction | null; // For use with enhance function and form action endpoint
handleConfirm?: (() => void) | (() => Promise<void>); // Perform action before closing dialog
children?: Snippet;
}
let {
open = $bindable(false),
title = '',
description = '',
message = '',
action = null,
loading = false,
showCancelButton = false,
confirmButtonText,
confirmButtonVariant = 'default',
submitFunction = null,
handleConfirm = () => {},
children,
}: Props = $props();
const handleConfirmAndClose = async (event: Event): Promise<void> => {
event.preventDefault();
await handleConfirm();
open = false;
};
</script>
<Dialog.Root bind:open>
<!-- <Dialog.Trigger>
</Dialog.Trigger> -->
<Dialog.Content class="rounded-lg">
{#if title !== '' || description !== ''}
<Dialog.Header class="gap-2 text-left">
{#if title}
<Dialog.Title>{title}</Dialog.Title>
{/if}
{#if description}
<Dialog.Description>
{description}
</Dialog.Description>
{/if}
</Dialog.Header>
{/if}
{#if message}
<div class="pb-2">{message}</div>
{/if}
{#if submitFunction}
<!-- Enhanced form that sends request to form action endpoint -->
<form use:enhance={submitFunction} {action} method={action != null ? 'post' : undefined} class="flex flex-col gap-4">
{@render children?.()}
<DialogFooter bind:open {loading} {showCancelButton} {confirmButtonText} {confirmButtonVariant}></DialogFooter>
</form>
{:else}
<!-- Perform action and close dialog -->
<form onsubmit={handleConfirmAndClose} class="flex flex-col gap-4">
{@render children?.()}
<DialogFooter bind:open {loading} {showCancelButton} {confirmButtonText} {confirmButtonVariant}></DialogFooter>
</form>
{/if}
</Dialog.Content>
</Dialog.Root> |
|
ok so it's the same bug as Hunta's - should be fixed in the latest version |
The fix in #13351 solved some issues but introduced others. This reworks the aliasing further to better check against the patterns that come up.
Fixes #13532
Fixes #13436
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.