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

Svelte 5 #156

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Svelte 5 #156

wants to merge 10 commits into from

Conversation

woutdp
Copy link
Owner

@woutdp woutdp commented Nov 13, 2024

"esbuild cdn_min --watch",
"esbuild main --watch"
]
"assets.build": ["cmd --cd assets node build.js"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While working off this branch I noticed when installing in a brand new Phoenix project the build mustn't run? When trying to import live_svelte, it can't find the module because the build artifacts don't exist ./priv/static/live_svelte.esm.js
Screenshot 2024-11-25 at 8 55 35 PM

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using the version number (currently 0.15.0-rc4) it should work properly since I build the files and publish them as a package to hex. So I think this only applies when you're using the github branch. Not sure if this is really an issue. Also I think this might have been an issue in the previous version too, not specific to the Svelte 5 release I think.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, makes sense. Thanks for the clarification.

Copy link

@christophertrudel christophertrudel Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember now why I was using this branch, I used my own fork to rebase master branch because this PRs branch doesn't include this commit 97ed136 from master. Which seems to resolve another issue where mix live_svelte.setup seems to have issues finishing correctly. It looks as if I am missing package.json.
Should you rebase and release a new RC?

Screenshot 2024-11-26 at 8 55 02 PM Screenshot 2024-11-26 at 9 01 26 PM

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed this comment in this open issue. So I think to use the RC on a new project we will need the rebase with the fix.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!
Just released 0.15.0-rc.5

@woutdp woutdp force-pushed the svelte-5 branch 2 times, most recently from 42a5228 to 466739f Compare November 27, 2024 01:46
@woutdp
Copy link
Owner Author

woutdp commented Nov 27, 2024

Small update on this one, so the reason this is not merged yet is that I have a project where it's not working 100%. There's an issue when using components that use child Svelte components in that project. This does not occur in other projects. I haven't had the chance to look at it more deeply, as soon as that's fixed and I don't hear any issues in the community, this will be merged and released

@christophertrudel
Copy link

Thanks for the BUMP @woutdp
As for the merge of the PR, makes sense to let it bake and weed out any issues.
Great work on the project by the way.

@christophertrudel
Copy link

Worked like a charm.
Screenshot 2024-11-26 at 10 28 57 PM

@christophertrudel
Copy link

So for parity tests I copied the example_project into the new phoenix app. I ran into a Svelte 5 compatibility issue. Also pointed out in this issue
Screenshot 2024-11-28 at 1 21 47 PM

Sure enough, adding compatibility.componentApi fixes this.

plugins: [
    importGlobPlugin(),
    sveltePlugin({
        preprocess: sveltePreprocess(),
        compilerOptions: {dev: !deploy, hydratable: true, css: "injected", compatibility: {componentApi: 4}},
    }),
],

I would have thought that this would not have happened because when I look at the changes on this branch it looks as if you have taken care of this here with the new hydrateOrMount.

I then experienced another issue
Screenshot 2024-11-28 at 2 27 12 PM

Something seemed off, and when I clicked into the offending code in the browser I could see that I was looking at old code.
Screenshot 2024-11-28 at 2 29 30 PM

Turns out 0.15.0-rc.5 seems to not have built the artifacts correctly.
Screenshot 2024-11-28 at 2 16 50 PM

I looked back at 0.15.0-rc.4 and it was fine.
Screenshot 2024-11-28 at 2 25 36 PM

I think we need to cut another release to resolve the issue with the artifacts.

@woutdp
Copy link
Owner Author

woutdp commented Nov 28, 2024

@christophertrudel thank you, just released 0.15.0-rc.6. I think the artifacts are correct now, can you test again?

@christophertrudel
Copy link

@christophertrudel thank you, just released 0.15.0-rc.6. I think the artifacts are correct now, can you test again?

Confirmed. Thanks for the quick turn around.

import TextInput from "./TextInput.svelte"

export let live
let {live} = $props()

let textInput = "Content"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be let textInput = $state("Content")

@@ -10,7 +12,7 @@
}
</script>

<form on:submit|preventDefault={handleForm}>
<form onsubmit={preventDefault(handleForm)}>
<TextInput value={textInput} name="element" id="123456" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be <TextInput bind:value={textInput} name="element" id="123456" />

@cvkmohan
Copy link

So, at this moment, to work with svelte 5, - for a new project, we add

{:live_svelte, "~> 0.15.0-rc.6"}

to the mix file - and - things should work?

@christophertrudel
Copy link

@cvkmohan that is correct.
Add {:live_svelte, "~> 0.15.0-rc.6"}

And follow instructions here https://github.com/woutdp/live_svelte/tree/svelte-5?tab=readme-ov-file#installation
Everything from the Example Project looks like it is working with the exception of the LiveJson example by the looks of it.
It loads in the first page load but removing an element seems to have issues.

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

Successfully merging this pull request may close these issues.

3 participants