Open mdmower opened 5 months ago
Thanks for looking into it. At the moment, the "fix" would be to use the default export with:
purgecss.default({
content: ["src/index.ts"],
}),
I will add a named export for purgeCSSPlugin, so that in the future it will be imported with
import { purgeCSSPlugin } from "@fullhuman/postcss-purgecss"
When will next package version be published? I need this
Describe the bug
When I set my project to ESM (
"type": "module"
inpackage.json
), the import of@fullhuman/postcss-purgecss
in my build script has the wrong type. I have to coerce the type with(purgecss as unknown as typeof purgecss.default)({...})
for the type check to pass.To Reproduce
I've created a minimal example at https://github.com/mdmower/purgecss-export/ to demonstrate this issue. After cloning the project and running
npm install
, you can runnpm run check-types
to see the type error (it's also visible in VSCode, see file build/build.ts).Expected Behavior
ESM import type of
@fullhuman/postcss-purgecss
should be a function.Environment
Debian 12 Node.js 20.15.0 npm 10.8.1
Add any other context about the problem here
Potentially useful resources:
Code of Conduct