Giter Club home page Giter Club logo

Comments (7)

yookers avatar yookers commented on May 24, 2024 1

I tried using the pnpm override fix in package.json but it didn't work. I was playing around with it some more and it seems like it's actually {...props} that is affecting it. I can actually use {@render children()} normally but as soon as I pass in {...props}, it gives the error ParseError: Unexpected character '@'.

// This fails.
<script lang="ts">
	import type { Snippet } from 'svelte';

	let { children, ...props } = $props<{
		children: Snippet;
	}>();
</script>

<button {...props}>
	{@render children()}
</button>
// This works.
<script lang="ts">
	import type { Snippet } from 'svelte';

	let { children, ...props } = $props<{
		children: Snippet;
	}>();
</script>

<button>
	{@render children()}
</button>

from monorepo.

yookers avatar yookers commented on May 24, 2024 1

I made an example SvelteLab environment, it will work if you remove {...props} or you remove paraglide({}) inside of vite.config.js plugins:

SvelteLab Env

from monorepo.

LorisSigrist avatar LorisSigrist commented on May 24, 2024

It's probably using the Svelte 4 compiler to try and compile the svelte 5 code. I'll try to update it so that it uses whatever svelte version is used in the current project.

from monorepo.

LorisSigrist avatar LorisSigrist commented on May 24, 2024

Jup, was that. I'll turn the adapter's dependency on svelte into a peerDependency.

If you are using pnpm you can immediately fix your issue by adding the following to your package.json

 "pnpm": {
    "overrides": {
      "svelte": "$svelte"
    }
},

This will force any package in your dependency graph to use your version of svelte

from monorepo.

LorisSigrist avatar LorisSigrist commented on May 24, 2024

This code is working perfectly fine for me. Do you have a repo I could take a look at?
Screenshot 2024-03-08 at 12 58 07

from monorepo.

s24407-pj avatar s24407-pj commented on May 24, 2024

"pnpm": { "overrides": { "svelte": "$svelte" } },

this + pnpm i worked for me

from monorepo.

yookers avatar yookers commented on May 24, 2024

Oh you're right, I guess it was due to peerDependency issues with Svelte after all. I didn't realize that it wouldn't work before with just adding the pnpm override. Now that I tried deleting node_modules and then doing a fresh install with pnpm i, it now works properly. Thanks for the fix. 😄

from monorepo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.