rogden / tailwind-config-viewer

A local UI tool for visualizing your Tailwind CSS configuration file.
2.01k stars 111 forks source link

Ship esm version #49

Closed tobiasdiez closed 6 months ago

tobiasdiez commented 2 years ago

Currently, in the distributed/published version only commonjs is used. It would be nice if they would be also published as esm. This is needed for nuxt3/bridge, see https://github.com/nuxt-community/tailwindcss-module/issues/390 and https://v3.nuxtjs.org/concepts/esm#library-author-guide.

rogden commented 2 years ago

Thanks for the report. I'll need to dig into how to best do this. Might have to create a v2 and force node 12 instead of >=8. From my quick research it seems it can be quite a pain to manage both a cjs and esm version of a library.

tobiasdiez commented 2 years ago

Thanks for looking into this. Maintaining cjs + esm is indeed sadly not easy. The nuxt team developed https://github.com/unjs/unbuild that aims to help with this (I have no experience with this tool, but maybe its helpful).

rogden commented 2 years ago

As a quick fix so you can continue to use the viewer...you can turn it off in the Tailwind Nuxt Module config and then use it directly via npx tailwind-config-viewer assuming you have created a tailwind.config.js file in your Nuxt project root.

DavidDeSloovere commented 1 year ago

Is there still a need to support both cjs and esm? Maybe we can move forward with esm only.

bkjohnson commented 9 months ago

@rogden would you accept PR(s) to make this compatible with ESM tailwind configs? I'd be willing to help with that. Additionally, Node 18 is the lowest node version that isn't end of life, so a v2 release could include dropping unsupported node versions as well as a move to ESM compatibility.

rogden commented 9 months ago

@bkjohnson Absolutely!

bkjohnson commented 9 months ago

@rogden I opened #91 as a first step. I'm not a vue expert, but I'm assuming that being on the latest vue that uses vite will make it easier to ship a version with esm compatibility.

rogden commented 6 months ago

ESM support added in v2. Closing this out for now.

ineshbose commented 6 months ago

If I'm not wrong, this issue is more about the library moving to ESM syntax internally so possibly the surrounding ecosystem can also take advantage and benefit from it?

tobiasdiez commented 6 months ago

Supporting esm config files is nice, but I've opened this issue indeed with the wish to have a esm-version of the whole config-viewer package.

Could you please reopen the issue @rogden?

ineshbose commented 5 months ago

Supporting esm config files is nice, but I've opened this issue indeed with the wish to have a esm-version of the whole config-viewer package.

92 seems to be fresher issue