svelte icon indicating copy to clipboard operation
svelte copied to clipboard

Compiler options `runes: true` should only affects the user components as defined in `src`

Open jeannemas opened this issue 1 year ago • 4 comments

Describe the bug

Currently (at least, until 5.0.0-next.125), when we set runes: true inside of svelte.config.js, all the components inside our app (including the ones packaged from external libraries) are forced into runes mode.

However this has the side effect of preventing the use of slighly older libraries that might not have native runes support, one such example is sveltekit-superforms.

My question is should the compiler options runes: trues only affects user components as defined in src? If not, the docs should clearly state that it also affects the third party ones.

See the reproduction link bellow for an example.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-tqyv6t

Logs

No response

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    svelte: ^5.0.0-next.125 => 5.0.0-next.125

Severity

blocking an upgrade

jeannemas avatar May 09 '24 14:05 jeannemas

You can just install svelte 5 and start using runes in your components to unlock runes mode for those components.

paoloricciuti avatar May 09 '24 14:05 paoloricciuti

I don't think the behavior here should change, nor should the core compiler be aware of things like 'in src' and 'in node_modules'.

The recommended way to handle this would be with https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#dynamiccompileoptions - although the code example is out of date - it no longer lives under experimental - I'll open a PR for that shortly.

Conduitry avatar May 09 '24 14:05 Conduitry

I don't think the behavior here should change, nor should the core compiler be aware of things like 'in src' and 'in node_modules'.

The recommended way to handle this would be with https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#dynamiccompileoptions - although the code example is out of date - it no longer lives under experimental - I'll open a PR for that shortly.

I didn't know about this config entry, I'll make sure to check it out! Thanks for your fast answer!

jeannemas avatar May 09 '24 14:05 jeannemas

https://github.com/sveltejs/svelte/issues/10359#issuecomment-2099316495 - I have used a similar approach in SvelteKit exactly with sveltekit-superforms and, I confirm, it works.

Serator avatar May 11 '24 00:05 Serator