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

Migrate from Svelte 4 to Svelte 5 #106

Open
grmbyrn opened this issue Oct 29, 2024 · 3 comments
Open

Migrate from Svelte 4 to Svelte 5 #106

grmbyrn opened this issue Oct 29, 2024 · 3 comments

Comments

@grmbyrn
Copy link
Collaborator

grmbyrn commented Oct 29, 2024

With the release of Svelte 5, it's a good time to migrate from Svelte 4. The benefits of Svelte 5 include:

  • Enhanced compiler optimisations which lead to smaller bundles and faster load times.
  • The introduction of "runes" allows for more intuitive reactivity, reducing boilerplate code and simplifying state management​.
  • Native TypeScript support means direct TypeScript annotations in Svelte files improve development efficiency and maintainability without additional preprocessing.
@da2ce7
Copy link
Contributor

da2ce7 commented Oct 30, 2024

Hello @grmbyrn What of these enhancements of Svelte 5 provides benefits for our project?

@grmbyrn
Copy link
Collaborator Author

grmbyrn commented Oct 30, 2024

Hello @grmbyrn What of these enhancements of Svelte 5 provides benefits for our project?

Hi @da2ce7 I'm still digging into the changes but the big enhancements for us that I see so far are:

  • Quicker load times for blog pages as Svelte 5's fine-grained reactivity ensures only necessary components are re-rendered. In Svelte 4, when state change occurred, the entire component would re-render.
  • Changing from the reactivity marker $ to runes will improve state management as reactive variables can now be defined directly. This will make the flow of data through our project easier to manage and to understand.
  • Also, Svelte 4 syntax will be phased out over time, so it would be proactive to make changes now before it eventually starts breaking in places. This is also Svelte's first major update since Svelte 3 in 2019 so it's reasonable to suggest that these changes haven't been made lightly and will be around for the long-term.

@grmbyrn
Copy link
Collaborator Author

grmbyrn commented Oct 31, 2024

@histoire/[email protected] has a strict peer dependency on svelte@^3.0.0 || ^4.0.0, and cannot resolve [email protected]. This is the main reason for the ERESOLVE conflict:

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @histoire/[email protected]
npm error Found: [email protected]
npm error node_modules/svelte
npm error   peer svelte@">4.0.0" from @iconify/[email protected]
npm error   node_modules/@iconify/svelte
npm error     dev @iconify/svelte@"^4.0.2" from the root project
npm error   peer svelte@"^4.0.0 || ^5.0.0-next.0" from @sveltejs/[email protected]
npm error   node_modules/@sveltejs/kit
npm error     peer @sveltejs/kit@"^2.0.0" from @sveltejs/[email protected]
npm error     node_modules/@sveltejs/adapter-static
npm error       dev @sveltejs/adapter-static@"^3.0.1" from the root project
npm error     dev @sveltejs/kit@"^2.5.27" from the root project
npm error   6 more (eslint-plugin-svelte, prettier-plugin-svelte, ...)
npm error
npm error Could not resolve dependency:
npm error peer svelte@"^3.0.0 || ^4.0.0" from @histoire/[email protected]
npm error node_modules/@histoire/plugin-svelte
npm error   dev @histoire/plugin-svelte@"^0.17.17" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/svelte
npm error   peer svelte@"^3.0.0 || ^4.0.0" from @histoire/[email protected]
npm error   node_modules/@histoire/plugin-svelte
npm error     dev @histoire/plugin-svelte@"^0.17.17" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /Users/macbookair/.npm/_logs/2024-10-30T18_33_29_085Z-eresolve-report.txt
npm error A complete log of this run can be found in: /Users/macbookair/.npm/_logs/2024-10-30T18_33_29_085Z-debug-0.log

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