Open davay42 opened 2 years ago
I tried these
import { createRequire } from 'node:module'
require.resolve('pug')
to createRequire(import.meta.url).resolve('pug')
https://github.com/windicss/vite-plugin-windicss/blob/d5ad27b6e8252dd6aad00b1e0630d8530b60dd85/packages/plugin-utils/src/extractors/helper.ts#L18 require('pug')
to createRequire(import.meta.url)('pug')
https://github.com/windicss/vite-plugin-windicss/blob/d5ad27b6e8252dd6aad00b1e0630d8530b60dd85/packages/plugin-utils/src/extractors/pug.ts#L8Reference from https://stackoverflow.com/questions/59443525/require-not-working-in-module-type-nodejs-script
Describe the bug I've been struggling with windicss not producing styles for my lang="pug" Vue SFCs in my components library. Manually adding the
WindiCSS({ extract: [PugExtractor], }),
didn't help. But then I looked through the extractor code and saw the dynamic require of pug. This lead me to try to remove"type="module"
line in my package.json and all the styles got generated just fine.Actual repo https://github.com/DeFUCC/gun-vue/tree/master/components
Versions
Additonal Context