kalimahapps / vscode-tailwind-config-viewer

VSCode extension to display tailwind config in sidebar
MIT License
8 stars 0 forks source link

Plugin doesn't work properly with TS config file #12

Closed dmitrystas closed 4 months ago

dmitrystas commented 7 months ago

Plugin doesn't work properly (shows all default props instead defined ones) when I use tailwind.config.ts, but works fine with tailwind.config.js

There is a very simple config, just for a test

export default {
  theme: {
    colors: {
      night: '#132137',
      navy: '#1D2A30',
      sand: '#EEECE6'
    }
  }
}

tailwind.config.ts изображение_2024-04-08_094959525

tailwind.config.js изображение_2024-04-08_095215867

dmitrystas commented 6 months ago

it looks like we should to replace

https://github.com/kalimahapps/vscode-tailwind-config-viewer/blob/e35d2ed3133c32e4bbcf481d71d0a2da4867c96a/src/tailwind-config.ts#L6

with

import { requireFromString, importFromString } from 'module-from-string';

and

https://github.com/kalimahapps/vscode-tailwind-config-viewer/blob/e35d2ed3133c32e4bbcf481d71d0a2da4867c96a/src/tailwind-config.ts#L125

with something like this

workspaceConfig = (await importFromString(transpile.outputText)).default;

abdul-alhasany commented 4 months ago

Thanks for the question and the solution. This is resolved in latest version.