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

build fails when using vercel adapter (no not the same as the other ticket) #3104

Closed
jmsunseri opened this issue Dec 24, 2021 · 10 comments
Closed

Comments

@jmsunseri
Copy link

Describe the bug

I'm creating a state machine use xstate and my someMachine.ts file does

import { useMachine } from '@xstate/svelte';

works fine locally using adapter-auto but switching to adapter-vercel causes the build to fail saying

'lib.useMachine is not a function'

changing import statement to

import { useMachine } from '@xstate/svelte/lib/useMachine';

resolves the issue;

Reproduction

none at this time

Logs

No response

System Info

System:
    OS: macOS 11.6.1
    CPU: (4) x64 Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz
    Memory: 201.83 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.18.2 - /usr/local/bin/node
    Yarn: 1.22.15 - /usr/local/bin/yarn
    npm: 6.14.15 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 96.1.33.106
    Chrome: 96.0.4664.110
    Safari: 15.2

Severity

annoyance

Additional Information

thank you for your time

@Figments
Copy link

i'm having a similar issue with a shared models library, everything in it seems to be imported correctly except a single enum, which SvelteKit thinks is not exported. this isn't a problem in my backend API project, which uses the same shared library and imports the same things.

@jmsunseri
Copy link
Author

jmsunseri commented Dec 24, 2021 via email

@benmccann
Copy link
Member

Reproduction
none at this time

I'm sorry, but the reproduction isn't optional. I'm happy to take a look at this if there's a way to reproduce on my machine

@jmsunseri
Copy link
Author

You don't have to close a legitimate issue without at least asking me and giving me a day to come up with a reproduction. What the best way to provide a repro for a build issue that only pops up on a specific adapter? is there a REPL that will support this case?

@jmsunseri
Copy link
Author

@benmccann I tried to reproduce on a project from scratch but was unable to. I just granted you access to my private repo. You should be able to pull down the 'build-issue' branch and run yarn build to see the issue.

@benmccann
Copy link
Member

benmccann commented Dec 27, 2021

I can't build your project because it's saying supabaseUrl is required. But anyway, I'm guessing there might not be a lot we can do because the entire xstate packaging situation seems like a mess:

Hopefully that library will fix its packaging at some point. There seems to be a PR pending that says it fixes some things to allow it to work on SvelteKit: statelyai/xstate#2474. Perhaps you can ping that PR and see if it can be merged

@jmsunseri
Copy link
Author

jmsunseri commented Dec 27, 2021 via email

@benmccann
Copy link
Member

The auto adapter isn't actually running the whole build process. If you tried to build using the auto adapter on Vercel it would detect that platform and fail in the same way. But if you try to build locally with the auto adapter then it doesn't know you want to build for Vercel and so it doesn't complete the build and gives you the warning:

Could not detect a supported production environment. See https://kit.svelte.dev/docs#adapters to learn how to configure your app to run on the platform of your choosing

@jmsunseri
Copy link
Author

I have fixed the repo so that it should have some dummy information for the supabase config so you should get past that. I would also like to note that the library that is actually being complained about was '@xstate/svelte' not 'xstate'

@benmccann
Copy link
Member

I still think the best solution is to try to get statelyai/xstate#2474 merged

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

3 participants