Skip to content

[postcss] tsup fails if postcss.config.js is es module #874

@jens-ox

Description

@jens-ox

Repro link: https://codesandbox.io/p/sandbox/adoring-hill-k94yyv (script build:tsup)

If postcss.config.js is an es module (i.e. export default { ... }), tsup fails:

> tsup

CLI Building entry: src/index.ts
CLI tsup v6.7.0
CLI Using tsup config: /project/home/jens-ox/workspace/tsup.config.js
CLI Target: esnext
ESM Build start
✘ [ERROR] require() of ES Module /project/home/jens-ox/workspace/postcss.config.js from /project/home/jens-ox/workspace/node_modules/.pnpm/lilconfig@2.1.0/node_modules/lilconfig/dist/index.js not supported.
Instead change the require of postcss.config.js in /project/home/jens-ox/workspace/node_modules/.pnpm/lilconfig@2.1.0/node_modules/lilconfig/dist/index.js to a dynamic import() which is available in all CommonJS modules. [plugin postcss]

Not fully sure why this is the case - lilconfig@2.1.0 should support es modules (since 2.0.5). When compiled with postcss-cli or tailwindcss (both also using postcss-load-config@3.1.4), no errors occur.

Maybe this is fixable by just updating postcss-load-config?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions