mrmckeb / typescript-plugin-css-modules

A TypeScript language service plugin providing support for CSS Modules.
MIT License
1.32k stars 73 forks source link

Consider making `sass` an optional peerDependency #253

Open wojtekmaj opened 8 months ago

wojtekmaj commented 8 months ago

I believe there's a good amount of users using typescript-plugin-css-modules for, well, CSS modules. The ones using Sass will have to have sass dependency installed anyway in order for Sass to work in their project (correct me if I'm wrong).

Sass makes almost 50% of typescript-plugin-css-modules's install size: https://packagephobia.com/result?p=typescript-plugin-css-modules https://packagephobia.com/result?p=sass so making it optional would significantly improve package install time. Especially since sass depends on chokidar which depends on fsevents which depends on (God forbid!) node-gyp.

Therefore, I think it would be worth considering making sass an optional peerDependency.

mrmckeb commented 7 months ago

Hi @wojtekmaj, we've definitely had a few requests around splitting out packages in the past.

Sass is heavily used by the users of this plugin, and is pretty much the only thing people raise issues about haha. The issue with removing the dependency is that it's VERY hard to tell users what's wrong when the plugin can't resolve Sass properly in their project. They might also have a version that's too new or too old, so we'd need to be very specific with supported ranges.

As an alternative path, we've talked about splitting this plugin up so that it has "transformers"(?) that need to be installed alongside it for things like Sass. That would take a little time to do though, which is why I haven't tackled it yet. But I think that would solve your issue?