finsweet / developer-starter

Developer starter template for Finsweet projects.
https://www.finsweet.com/
185 stars 67 forks source link

Add(chore): jquery on dev mode only #18

Closed armandsalle closed 2 years ago

armandsalle commented 2 years ago

Hey 👋

This PR is about including jQuery with the types to the dev env but remove this external librairie at the build time.

Why?

This template will be used mostly by Webflow developers, and some of them are using jQuery. But a lot of Webflow developers has not the experience of real typescript developers, so including it by default and remove it from the build out of the box may be a good idea. I had the case with a friend learning typescript with Webflow today. I talked about ESBuild to him, the @types packages and it was a lot to understand.

How?

By installing jquery and @types/jquery to the project.

How to test?

Use jquery to do a simple task, it should works as excepted. Build the code, jquery should not be part of the bundle.

armandsalle commented 2 years ago

Hey! Yes you right, I just test it and ESBuild doesn't transform the $. So it works out of the box the the jquery types

alexiglesias93 commented 2 years ago

@erikmejias what do you think? I think it's good to have jQuery type definitions for the community users, but I also think that we should update the README.md to make it clear for future teammates that we won't accept any jQuery code in any Finsweet-related project.

armandsalle commented 2 years ago

I think it's great to add explanations in the README.md 👍

erikmejias commented 2 years ago

I like this idea, thanks for the contribution @armandsalle. I think it could go without any extra documentation as we internally have the no-jQuery rule almost set in stone, but either way works great.

@alexiglesias93 as a side note: it might be a good idea to establish where the dev-starter should be leaning the most: the community or us. Right now this is a simple change, but over time having this clear will make for easier decisions.