windicss / vite-plugin-windicss

🍃 Windi CSS for Vite ⚡️
MIT License
854 stars 65 forks source link

Unable to use prefix configuration #232

Open rex-ll opened 3 years ago

rex-ll commented 3 years ago

Describe the bug Unable to use prefix configuration

Minimal Reproductions

vite.config.js

import windiCSS from 'vite-plugin-windicss';

export default () => {
 // ***
  return {
    plugins: [windiCSS()]
  }
 // ***
}

windi.config.js

import { defineConfig } from 'vite-plugin-windicss';
export default defineConfig({
  prefix: 'test-',
})
[vite] Internal server error: Cannot read property 'type' of undefined
      at sortMeta (D:\experimental\test\node_modules\windicss\lib\index.js:1069:16)
      at Array.sort (<anonymous>)
      at StyleSheet.sort (D:\experimental\test\node_modules\windicss\lib\index.js:1219:39)
      at Processor.interpret (D:\experimental\test\node_modules\windicss\lib\index.js:11502:36)
      at buildPendingStyles (D:\experimental\test\node_modules\@windicss\plugin-utils\dist\index.js:754:32)
      at Object.generateCSS (D:\experimental\test\node_modules\@windicss\plugin-utils\dist\index.js:798:5)
      at async Context.load (D:\experimental\test\node_modules\vite-plugin-windicss\dist\index.js:75:21)
      at async Object.load (D:\experimental\test\node_modules\vite\dist\node\chunks\dep-972722fa.js:51335:32)
      at async transformRequest (D:\experimental\test\node_modules\vite\dist\node\chunks\dep-972722fa.js:67037:24)
      at async viteTransformMiddleware (D:\experimental\test\node_modules\vite\dist\node\chunks\dep-972722fa.js:67225:32)

Versions

Additonal Context

AGPDev commented 3 years ago

I have this problem too

@DoubleRayWang in my case after remove one module in extract includes solve the problem. Maybe your prefix is much generic