-
Notifications
You must be signed in to change notification settings - Fork 259
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
does trunk support install and build npm package #32
Comments
@ensonmj great question. If you are just pulling in web-ready JS, then yes, Trunk already supports this. Check out the README on the section about However, Trunk does not currently have support for doing JS/TS transpilation or anything like that. It is possible that we might be able to add support for doing this with something like SWC, which I think would be pretty cool. At this point, I haven't even started planning that feature yet. Does your use of |
TS compiler would be nice. If I have to write JS (e.g. web components, Rust/JS library bridges, ..) I would rather use Typescript. |
TBH, the thing which I am concerned about, and which so far I have really wanted to avoid, was getting into the JS/TS compilation/transpilation game. I feel like doing so would require a fair amount of work, and would detract from Trunk's core focus, which is "Rust first". I definitely think there is room for shelling out to something like @MartinKavik @ensonmj (and of course anyone else) any feedback on what your preference would be here? What do you think would be a good balance for Trunk? |
TBH,I don't know much about |
Read the last paragraph: denoland/deno#5432 (comment). I've just refreshed my knowledge about Typescript from the era when I was a back-end Typescript developer and I'm not sure we want to integrate Pandora's box with TS/Npm/Yarn/Tsc/Deno/Node/TS linters/TS formatters/* directly into Trunk. However So I think one way to move forward would be to write examples with Trunk and TS-related tools so users know how to setup Rust/TS projects with their favorite TS/JS tools and libraries. And we can implement some general Trunk pipeline hooks and dev server endpoints to allow communication between these tools and Trunk to make the integration easier. To have an idea what JS/TS tools may be useful, there is a list from seed-rs.org / Seed webpack quickstart:
|
@ensonmj yea, you do make a good point that many real-world projects will have some JS/TS which needs to be processed. This is the web after all. @MartinKavik agreed. Whatever path we take on this front, I definitely want to avoid Pandora's box. FWIW, the main reason that I decided to create Trunk is because the typical workflow for creating a Rust WASM was a JS first workflow:
... no good. So with Trunk we take the opposite approach. Get your Rust project setup, and that's all. No node, no npm, no JS bundler needed. Long-term ... that will be even more of a strength as WASM becomes more widespread. I would like to preserve that as much as possible moving forward. That said, we still need to be honest with ourselves about JS being around for a while. So some support is definitely needed. Leading into next comment -> |
@ensonmj @MartinKavik (any anyone else) what would you like to see for JS/TS integration? What do you think would be best?
|
I think the simplest way forward would be:
Imho it should be enough to cover most of the cases and we can introduce other features when needed. |
@MartinKavik && @ensonmj once #73 lands, we will have a pretty simple path for adding some asset pipelines to accomplish this. Here are a few ideas, I'm interested to see what you folks think:
Either way, we could support all of the above options, and others long-term. Let me know what you all think. Anything critical which you think this design is overlooking? Maybe there is a better way to do this, thoughts? |
A JS bundler that I particularly like is Snowpack. I believe trunk should have something similar (either defined in This is pretty similar to option 2 (#32 (comment)) but more flexible (imo). Edit: In fact, this might be implemented as a plugin itself when #104 happens, whenever that may be. |
Any update on this? |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Any update on this? 🙂 |
No, sorry. |
So what's a good solution if I need NPM deps (JS/TS/WASM) to be transpiled/minified/bundled with my full-stack Rust application (Leptos + Axum + Tailwind, using cargo-leptos), so that it also works with hot-reloading in dev mode? |
hi
I have a yew project with npm package
material-components-web
as a dependency.now I use parcel to build the project.
Does trunk support this dependency management?
thx
The text was updated successfully, but these errors were encountered: