-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Default export causes lifecycle_outside_component
#217
Comments
lifecycle_outside_component
I am still getting the same exact error with the latest bits-ui and runed releases, but have failed to pinpoint the root cause (see error below). For me this only happens with Vite 6 btw. @ESchouten How exactly do you add runed to all consumers, simply importing it like so: import * as runed from 'runed'; and does it work for you with runed 0.23.4? Uncaught Error Error: https://svelte.dev/e/lifecycle_outside_component
at lifecycle_outside_component (.../node_modules/.pnpm/[email protected]/node_modules/svelte/src/internal/shared/errors.js:32:9)
at get_or_init_context_map (.../node_modules/.pnpm/[email protected]/node_modules/svelte/src/internal/server/context.js:51:5)
at setContext (.../node_modules/.pnpm/[email protected]/node_modules/svelte/src/internal/server/context.js:28:2)
at set (.../node_modules/.pnpm/[email protected][email protected]/node_modules/runed/dist/utilities/context/context.js:63:16)
at useTooltipProvider (.../node_modules/.pnpm/[email protected][email protected]/node_modules/bits-ui/dist/bits/tooltip/tooltip.svelte.js:275:35)
at Tooltip_provider (.../node_modules/.pnpm/[email protected][email protected]/node_modules/bits-ui/dist/bits/tooltip/components/tooltip-provider.svelte:16:2) |
@Magnus-Ignitic haven't updated yet, will do soon. I don't import Runed in my consumers, I just included Runed in the consumers package.json files. |
I see. I'm already using Runed directly in the consumer packages so something else the issue for me then 🤔 Still curious to know if 0.23.4 works for you once you update :) |
I found my culprit which is the following lines in vite.config.js: resolve: {
// The default would be [ 'svelte', 'node' ]
// as set by vite-plugin-svelte and vitest.
// This sets [ 'browser', 'svelte', 'node' ]
conditions: mode === 'test' ? ['browser'] : [],
}, used to make tests work. Reproductionhttps://www.sveltelab.dev/3aiwrh7bswdkxp6 SolutionFollowing the instructions on how to set up the Svelte testing library below, there is no apparent need to include Related links |
Describe the bug
Seems like the addition of the
default:
field to the package.json export in v0.23.3 prevents Runed from being run correctly in consumers of the package in my monorepo that uses Runed indirectly through Bits-UI. It does however work in the package itself. My temporary fix is to add Runed to all consumers.Reproduction
Create monorepo with a components package which contain Shadcn-Svelte/Bits-UI components and consume this package in another package or app
Logs
System Info
System: OS: macOS 15.3 CPU: (12) arm64 Apple M2 Max Memory: 2.93 GB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.13.1 - /usr/local/bin/node npm: 10.9.2 - /usr/local/bin/npm pnpm: 9.15.5 - ~/Library/pnpm/.tools/pnpm/9.15.5/bin/pnpm bun: 1.2.2 - /opt/homebrew/bin/bun Browsers: Chrome: 132.0.6834.160 Safari: 18.3
Severity
annoyance
The text was updated successfully, but these errors were encountered: