windicss / windicss-intellisense

Intelligent WindiCSS tooling for VS Code
https://marketplace.visualstudio.com/items?itemName=voorjaar.windicss-intellisense
MIT License
194 stars 16 forks source link

Adding Typography plugin to windi config breaks intellisense #152

Closed alteredorange closed 3 years ago

alteredorange commented 3 years ago

Currently running windicss with the cli. Can't get it to work unless I use a .cjs` config file, otherwise I get the following error:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /blog/windi.config.js
[1] require() of ES modules is not supported.

Using the following windi.config.cjs works fine, until I add the plugins section, and then intellisense stops working in vscode... If I comment out the plugins section, intellisense works again. Super weird! Also, the plugin gets loaded, and works correctly, so it just seems to affect intellisense, not actual plugin functionality.

module.exports = {
  theme: {
    extend: {
      colors: {
        dark: '#264653',
        h_dark: '#545863',
        h_blue: '#454ADE',
        h_yellow: '#EDF42A',
        h_orange: '#F96E46'
      },
      textColor: {
        h_iris: '#454ADE',
        h_mand: '#F4753E',
        h_yellow: '#EDF42A',
        h_orange: '#F96E46',
        h_blue: '#454ADE',
        h_black: '#545863',
        primary: '#3490dc',
        secondary: '#ffed4a',
        danger: '#e3342f'
      }
    }
  },
  plugins: [require('windicss/plugin/typography')]   <-- can comment this out and intellisense works again
}

Might be somewhat related to #149.

alexanderniebuhr commented 3 years ago

please check if you have updated everything to the latest version. The bug with the typography plugin was fixed by the latest version I guess

alexanderniebuhr commented 3 years ago

https://github.com/windicss/windicss-intellisense/issues/144

alteredorange commented 3 years ago

Yes, I had 0.17.2 installed, which looks like it's the latest version. It even happens on a completely blank project. Steps to reproduce:

  1. Brand new vscode project with two files: blank index.html and blank windi.config.cjs.
  2. Add <div class="bg-light-100" />. Intellisense works great.
  3. Change blank windi.config.cjs to have just:
    module.exports = {
    plugins: [require('windicss/plugin/typography')]
    }
  4. Go back to index.html and try to add another class, intellisense won't load.
  5. You can also go and just comment out the plugins line, and intellisense immediately works again:
    module.exports = {
    // plugins: [require('windicss/plugin/typography')]
    }

I also tried with version 17.1 (instead of 17.2) but had the same issue.

alexanderniebuhr commented 3 years ago

/stale can't repro