Skip to content

Conversation

@thomasbrettell
Copy link
Member

Updated the webpack svelte rules to follow those specified here.

For typescript projects verbatimModuleSyntax intsconfig.json needed to be set to true other wise imports inside <script lang='ts> blocks would be undefined (https://github.com/tsconfig/bases/blob/main/bases/svelte.json). Due to this I also updated react and preact typescript templates.
import { createRoot, Root } from 'react-dom/client'; --> import { createRoot, type Root } from 'react-dom/client';

…preact projects

- new versions of libraries in package-lock.json were causing tests to fail
- verbatimModuleSyntax was set to true in tsconfig.json for svelte 5 ts projects to work. the syntax for importing types in preact and react ts projects needed to be updated to adhere to this change
Copy link
Member

@AshKyd AshKyd left a comment

Choose a reason for hiding this comment

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

Awesome work!

Copy link
Member

@phocks phocks left a comment

Choose a reason for hiding this comment

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

Yeah this is cool!

@drzax
Copy link
Member

drzax commented Feb 7, 2025

This looks great, thanks @thomasbrettell! Have you tested it against any existing svelte 4 projects? I'm guessing it should work for them too.

@drzax drzax merged commit 7e16706 into main Feb 10, 2025
3 checks passed
@drzax drzax deleted the svelte-5 branch February 10, 2025 07:21
@thomasbrettell
Copy link
Member Author

Hi @drzax. Just seeing this now as I've been away.
I did a quick test with the most recent story I published (which was using svelte 4) and all seemed ok. Didn't have to make any changes other than using new svelte+aunty versions and using the new svelte 5 mount method. https://github.com/abcnews/la-fires/tree/svelte-5-migrate-test

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.

4 participants