const noOffsets = /*#__PURE__*/createCoords(0); reference issue #2810
Unanswered
PerpetualWar
asked this question in
Q&A
Replies: 3 comments 1 reply
-
Same thing happens with dom lib as well: const reference = ref<HTMLElement | null>(null);
const floating = ref<HTMLElement | null>(null);
const openDropdown = ref(false);
// const { floatingStyles } = useFloating(reference, floating, {
// placement: 'bottom',
// middleware: [
// size({
// apply({ rects, elements }) {
// Object.assign(elements.floating.style, {
// width: `${rects.reference.width}px`,
// });
// },
// }),
// offset(10),
// flip(),
// ],
// });
onMounted(() => {
if (reference.value && floating.value)
computePosition(reference.value, floating.value).then(({ x, y }) => {
console.log('x, y :>> ', x, y);
});
}); Both of these get the same error. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@atomiks any idea about this one? |
Beta Was this translation helpful? Give feedback.
1 reply
-
I ended up making wrapper component in app package and injecting useFloating and middlewares at runtime into this component from shared package, only leaving reference and floating refs in it. In wrapper (app package): <SelectEl
:init-floating="() => useFloating"
:floating-options="floatingOptions"
v-bind="$attrs"
/> and in original component (shared package): onMounted(() => {
const useFloatingParent = props.initFloating();
//@ts-ignore
floatingReturn.value = useFloatingParent(
reference,
floating,
props.floatingOptions,
);
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So Im using
@floating-ui/vue
in monorepo app, successfully already. Got lib installed in root of monorepo so every package can access it.However, when trying to use it in shared package (not real app, no app lifecycle, more collection of components and helpers, lib like), inside component Im getting error in app package:
floating-ui.dom.mjs:60 Uncaught ReferenceError: Cannot access 'j' before initialization at floating-ui.dom.mjs:60:1
(shared successfully builds)After enabling source maps , error seems to be in this line, after vite build:
const noOffsets = /*#__PURE__*/createCoords(0);
What is the issue here, is it impossible to use vue lib in such a setup? Do I need to fallback to dom or core version in this case?
Beta Was this translation helpful? Give feedback.
All reactions