xstate
xstate copied to clipboard
Bug: Svelte: import not working on Svelte REPL and CDN links in docs not working
Description
I was looking into prototyping using Svelte with http://svelte.dev/repl, but since state seems to rely on process the example given on https://xstate.js.org/docs/packages/xstate-svelte/#quick-start can't be used.
For reference, this example: https://svelte.dev/repl/4d4b6f1202884961adf79b08ef2389d7?version=3.48.0
So I figured I can use the CDN link instead, from the example page linked above, but the CDN link gives an error message when navigating to it: https://unpkg.com/@xstate/svelte/dist/xstate-svelte.min.js
Cannot find "/dist/xstate-svelte.min.js" in @xstate/[email protected]
REPL: https://svelte.dev/repl/b96890a9ffb2453eaabb25d505be3819?version=3.48.0
Expected result
import not available due to dependency on process.
CDN not available because not found.
Actual result
Either of the two approaches to work, preferably the regular import one.
Reproduction
https://svelte.dev/repl/4d4b6f1202884961adf79b08ef2389d7?version=3.48.0
Additional context
No response
I was looking into prototyping using Svelte with http://svelte.dev/repl, but since state seems to rely on process the example given on https://xstate.js.org/docs/packages/xstate-svelte/#quick-start can't be used.
Yea, in this instance we can't really fix it easily - we might try to fix this in v5 but I need to explore our bundling options before committing to it.
That being said - process.env.NODE_ENV is replaced with a string by SvelteKit. So perhaps this should be viewed as an issue with the Svelte REPL as it behaves differently from the recommended~ toolkit.
Cannot find "/dist/xstate-svelte.min.js" in @xstate/[email protected]
Ye, we currently don't provide such UMD bundle for @xstate/svelte. It should be fairly easy to add it though based on the existing configs in other packages.
There is currently no more error here; is the problem resolved?
Closing; feel free to reopen if the problem is not resolved.