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

Components not rendered in normal Svelte project #37

Closed
jerriclynsjohn opened this issue Jan 19, 2022 · 5 comments
Closed

Components not rendered in normal Svelte project #37

jerriclynsjohn opened this issue Jan 19, 2022 · 5 comments

Comments

@jerriclynsjohn
Copy link

jerriclynsjohn commented Jan 19, 2022

Reproduction Repo: https://github.com/jerriclynsjohn/svelte-headlessui-test-repo.git

I'm trying to use this in a regular svelte project, I've set up a normal repo with only tailwindcss as the additional dependency, and still, when I try to import and use Switch it breaks.

Tested with the svelte kit and it works perfectly but doesn't work with a regular svelte SPA

@rgossiaux
Copy link
Owner

Thanks for the report. It's because there are a few process.env.NODE_ENV references in the code, and the SvelteKit package command (which is what I use to package this up for NPM) doesn't replace them. Then the packaging in your test repo also does not handle process.env, it seems.

IMO there's no reason why the process.env references should be in the end-user package, so I filed a bug with SvelteKit: sveltejs/kit#3480

Depending on if/when we can get better handling of this in SvelteKit, I may add my own hacky find-and-replace step to the build process.

@jerriclynsjohn
Copy link
Author

Then the packaging in your test repo also does not handle process.env, it seems.

How can I handle this now, what should I do to make this work for now?

@rgossiaux
Copy link
Owner

I'll fix this in the next release (should be later today) by just adding some quick sed command to my release process or something. Hopefully we'll get some better support for this upstream in SvelteKit eventually.

@rgossiaux
Copy link
Owner

Just made a new release which fixes this.

@jerriclynsjohn
Copy link
Author

Hey this worked, thank you. I really appreciate this!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants