Can you also try creating a custom link component?
const CustomLink = React.forwardRef(function CustomLink(
props: React.ComponentProps<typeof NextLink>,
ref: React.Ref<HTMLAnchorElement>
) {
if (props.href) {
const {
href,
replace,
scroll,
shallow,
passHref,
prefetch,
locale,
...rest
} = props;
const isFragment = typeof href === "string" && href.startsWith("#");
return (
<NextLink
href={href}
replace={replace}
scroll={scroll != null ? scroll : isFragment ? false : undefined}
shallow={shallow}
passHref={passHref}
prefetch={prefetch}
locale={locale}
{...({ legacyBehavior: true } as any)}
>
<a {...rest} ref={ref} />
</NextLink>
);
} else {
return <a {...props} href={undefined} ref={ref} />;
}
});
and pass it into PlasmicRootProvider
?
...
<PlasmicRootProvider ... Link={CustomLink}>
...