-
-
Notifications
You must be signed in to change notification settings - Fork 244
Open
Labels
Description
Describe the bug
When I set my project to ESM ("type": "module" in package.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 run npm 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
"@fullhuman/postcss-purgecss": "^6.0.0",
"@types/node": "^20.14.9",
"css-loader": "^7.1.2",
"postcss-loader": "^8.1.1",
"style-loader": "^4.0.0",
"ts-loader": "^9.5.1",
"tsx": "^4.16.0",
"typescript": "^5.5.2",
"webpack": "^5.92.1"
Add any other context about the problem here
Potentially useful resources:
- https://arethetypeswrong.github.io/?p=%40fullhuman%2Fpostcss-purgecss%406.0.0
- This expression is not callable for ESM consuming CJS with default export microsoft/TypeScript#52086
Code of Conduct
- I agree to follow this project's Code of Conduct
weilinzung, jrson83, Ffloriel, brybrant and zwbetz-gh