Code Monkey home page Code Monkey logo

Comments (8)

gbj avatar gbj commented on May 21, 2024

I'm open to changing it; the reason they're excluded at present is so that the examples have the possibility of defining their own release profiles. If you move the examples from being excluded to being members of the workspace, it fires one of these warnings for each of them

warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /Users/gjohnston/Documents/Projects/leptos-main/leptos/examples/todomvc-ssr/todomvc-ssr-client/Cargo.toml
workspace: /Users/gjohnston/Documents/Projects/leptos-main/leptos/Cargo.toml

This suggests to me that we'd need to set a single profile for all the examples, but there are different settings that make sense for them. Particularly in the SSR + hydration examples, for release builds it's nice to optimize for size on the Wasm frontend and for speed on the server. It's not a big deal as these are just examples.

If anyone knows how to get around this problem, I'm open to hearing it.

I tend to just open the examples in their own editor window so I don't notice the lack of rust-analyzer support but that sounds like a pretty good argument for including them in the workspace. When you say rust-analyzer skips them, does that mean it just doesn't run at all for the examples? That's not ideal obviously.

from leptos.

oceantume avatar oceantume commented on May 21, 2024

When you say rust-analyzer skips them, does that mean it just doesn't run at all for the examples? That's not ideal obviously.

Indeed, that's what I mean. I'm not really knowledgeable in that area either but I'm interested in this project and I may try to play with the config a bit if I end up trying to contribute.

from leptos.

akesson avatar akesson commented on May 21, 2024

Sorry for the warning, it's due to my PR #22. The solution for the warning is to add an empty [workspace] at the top of the Cargo.toml that is not included in the workspace (I'll raise a PR for it as soon as I have some time for it).

Based on the hackernews example (@gbj, is this right?):

In the currently workspaced Leptos libraries, there are a set of mutually exclusive features: ssr, csr and hydrate.

When coding the app, it is done in a way that is compatible with all three.

When compiling the client, either csr or hydrate can be used. When compiling the server ssr needs to be enabled (if you want it).

This means that the server and client needs conflicting features and if included in the workspace there would be errors due to these conflicts.

It can potentially be solved by Cargo's Feature resolver 2 but would need more investigation.

from leptos.

gbj avatar gbj commented on May 21, 2024

@akesson Thanks — I'd be happy for a PR.

At this point csr is enabled by default when you import leptos. On example that are just client-side this is fine, no further setup.

On todomvc-ssr, the client and server each import todomvc, but disable its csr default feature and enable hydrate or ssr. This is why I have todomvc define features that in turn set the features on leptos.

Same for hackernews except that they're all in one directory. hackernews-app is the csr version, hackernews-server and hackernews-client are ssr and hydrate.

from leptos.

akesson avatar akesson commented on May 21, 2024

Sorry, not keeping up with the changes here... On latest main branch I don't get the warning and I see that @gbj already added examples as excluded (which has the same effect as adding [workspace] to the example projects' Cargo.toml.

from leptos.

gbj avatar gbj commented on May 21, 2024

I've decided to include the examples in the workspace and just define one profile at the workspace root... it's really not a big deal that we can't have a separate profile for the example servers.

from leptos.

adsick avatar adsick commented on May 21, 2024

I see that examples are removed from the workspace at this point, why is it?

from leptos.

adsick avatar adsick commented on May 21, 2024

@gbj can you explain please? Right now I see examples as excluded from the workspace. More on that in my feedback here: #2141.

from leptos.

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.